Commit graph

13 commits

Author SHA1 Message Date
Jamie McCrae
ec7044437e treewide: Disable automatic argparse argument shortening
Disables allowing the python argparse library from automatically
shortening command line arguments, this prevents issues whereby
a new command is added and code that wrongly uses the shortened
command of an existing argument which is the same as the new
command being added will silently change script behaviour.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-26 20:12:36 +09:00
Gerson Fernando Budke
f3a7f041bf scripts: runners: bossac: Add legacy mode
Add compatibility mode with old sam-ba flash bootloaders that don't have
offset capabilities.  These bootloaders flash to a pre-defined flash
region.  At end, bossac will suppress --offset parameter.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-21 21:20:58 +02:00
Martí Bolívar
778a18cb1a runners: tests: don't patch BuildConfiguration
Instead of mocking out the BuildConfiguration class, just create its
input file and let the real class do the work.

This in turn exposes a bug in the way the board name is being pulled
out of the BuildConfiguration, which we fix to keep the tests passing.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-03 09:55:33 -05:00
Martí Bolívar
09f55767b1 runners: tests: fix os.path.isfile patch
Copy a fix from test_nrfjprog.py to the other runner test suites. The
current code will enter an infinite recursion if you hit the path
where os.path.isfile is called, since it's been patched to
os_path_isfile_patch in the calling context. The fix is to cache the
'real' version in the parent scope and call it directly as a fallback.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-03 09:55:33 -05:00
Martí Bolívar
3204554841 scripts: runners: error on missing non-elf outputs
The RunnerConfig class stores the locations of the Zephyr output files
in various formats (elf, hex, bin). A longstanding issue with the
representation is that these might not exist if the corresponding
Kconfig options are not set. For example, if
CONFIG_BUILD_OUTPUT_BIN=n, there is no .bin file.

Change this so the type system knows these are Optional[str], not str.

Fix the runners that use non-ELF outputs so they check for the
existence of the relevant file before using it, mostly using a new
ZephyrBinaryRunner.ensure_output helper.

I'm not going to bother with checking for the ELF file itself; that's
always there as far as I can tell.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-02-02 14:01:22 -05:00
Gerson Fernando Budke
80d7253a47 scripts: runners: bossac: Fix offset parameter
The current bossac runner have multiple entries for flash offset
parameter.  Remove offset parameter from command line and rework
all infraestructure to get offset from device tree.  Add proper
verification routines to validate configurations on board and
device tree entries to fix SDK compatibility checks.

Fixes #29312.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-12-03 10:50:23 -06:00
Gerson Fernando Budke
3fe4c702e7 runners: bossac: Add speed argument
The current stty command uses a hard code value of 1200.  This is not
compliant with SAM-BA specs and may create compatibility problems.  Add
an optional speed argument with 115200 as default value following SAM-BA
specifications.  All boards that needs a different speed should define
board_runner_args(bossac "--speed=<value>") with value as required
speed.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-11-06 12:15:55 -06:00
c0055ed392 runners: bossac: calculate the offset instead of absolute address
BOSSA takes the offset within flash memory, not the absolute address.
This doesn't matter on most boards as the flash starts at zero but
does matter on the Due as the flash starts at +512 KiB.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-10-09 08:22:38 -05:00
bb8277962d scripts: bossac: automatically pull the flash offset from the config
BOSSAC uses a bootloader, so pull the flash address from DeviceTree or
the config and use if the version of BOSSAC supports offsets.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-02 08:23:03 -04:00
4ac195e0af scripts: bossac: add support for bossac 1.9.1
BOSSA 1.7 has built-in bootloader offset handling while 1.9.1
requires the user to supply the offset.  Add support for both by
sniffing the help output and warn the user if the flags needs adding.

Related to #22062

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-02 08:23:03 -04:00
Martí Bolívar
1c80d79fdd scripts: west_commands: skip bossac tests unless on linux
That's the only platform the tool is available.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-06 08:34:43 -06:00
Kuba Sanak
c0e31e7d71 flashing: don't give bossac offset parameter unless explicitly provided
This fixes a problem which appeared after bossac version was downgraded
to 1.7 which no longer accepts the -o/--offset parameter. Now the offset
is fed to bossac executable only if it's explicitly provided and not by
default.

Signed-off-by: Kuba Sanak <contact@kuba.fyi>
2020-01-28 12:53:13 -06:00
Marti Bolivar
c24e044c6e scripts: runners: check for required programs
Add self.require() checks before running commands. Increase test
coverage, including for this feature, while we are here.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-17 15:06:21 +02:00