Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
19602: dist/tools/compile_commands: add another workaround r=chrysn a=maribu

### Contribution description

Filter out GCC only `--param=min-pagesize=0` in `clangd` mode. This fixes compilation of rust applications, that now fails with:

    thread 'main' panicked at 'Unable to generate bindings: ClangDiagnostic("error: argument unused during compilation: '--param=min-pagesize=0' [-Wunused-command-line-argument]\n")', /home/maribu/.cargo/git/checkouts/rust-riot-sys-d12733b89271907c/b4bd4bd/build.rs:224:10


19618: cpu/stm32: fix riotboot settings for L4 and WB r=aabadie a=gschorcht

### Contribution description

This PR fixes the `riotboot` configuration for L4 and WB.

The family is not called `stm32l4` or `stm32wb` but `l4` and `wb`. That is, the `riotboot` configuration didn't work at all. Furthermore, a minimum `RIOTBOOT_LEN` of `0x2000` is required for L4.

Found when investigating the compilation errors for `bootloaders/riotboot_serial` in PR #19576.

### Testing procedure

1. Green CI.
2. Use the following commands:
    ```
    BOARD=nucleo-l496zg make -C tests/riotboot info-debug-variable-RIOTBOOT_HDR_LEN
    BOARD=p-nucleo-wb55 make -C tests/riotboot info-debug-variable-RIOTBOOT_HDR_LEN
    ```
    In master these commands give
    ```
    0x400
    ```
    With this PR these commands give
    ```
    0x200
    ```
    as expected.
3. Use the following commands:
    ```
    BOARD=nucleo-l496zg make -C tests/riotboot info-debug-variable-RIOTBOOT_LEN
    BOARD=p-nucleo-wb55 make -C tests/riotboot info-debug-variable-RIOTBOOT_LEN
    ```
    In master these commands give
    ```
    0x1000
    ```
    With this PR these commands give
    ```
    0x2000
    ```
    as expected.

### Issues/PRs references


19643: examples/suit_update: some test fixes r=aabadie a=kaspar030



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
  • Loading branch information
4 people authored May 23, 2023
4 parents f315012 + dd19110 + 2b96630 + a622c88 commit 361328c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
13 changes: 9 additions & 4 deletions cpu/stm32/stm32_riotboot.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,21 @@ ifneq (,$(filter $(CPU_FAM),f2 f4 f7))
# flash, to get evenly sized and distributed slots.
SLOT0_LEN ?= $(shell printf "0x%x" $$((($(ROM_LEN:%K=%*1024)-2*$(RIOTBOOT_LEN)) / $(NUM_SLOTS))))
SLOT1_LEN ?= $(SLOT0_LEN)
else ifeq (stm32l4,$(CPU_FAM))
else ifeq (l4,$(CPU_FAM))
# "The Vector table must be naturally aligned to a power of two whose alignment
# value is greater than or equal to number of Exceptions supported x 4"
# CPU_IRQ_NUMOFF for stm32l4 boards is < 91+16 so (107*4 bytes = 428 bytes ~= 0x200)
# CPU_IRQ_NUMOFF for stm32l4 boards is < 95+16 so (111*4 bytes = 444 bytes ~= 0x200)
# RIOTBOOT_HDR_LEN can be set to 0x200
RIOTBOOT_HDR_LEN ?= 0x200
else ifeq (stm32wb,$(CPU_FAM))

# Slot size is determined by "((total_flash_size - RIOTBOOT_LEN) / 2)".
# If RIOTBOOT_LEN uses an odd number of flashpages, the remainder of the
# flash cannot be divided by two slots while staying FLASHPAGE_SIZE aligned.
RIOTBOOT_LEN ?= 0x2000
else ifeq (wb,$(CPU_FAM))
# "The Vector table must be naturally aligned to a power of two whose alignment
# value is greater than or equal to number of Exceptions supported x 4"
# CPU_IRQ_NUMOFF for stm32l4 boards is < 91+16 so (107*4 bytes = 428 bytes ~= 0x200)
# CPU_IRQ_NUMOFF for stm32wb boards is < 63+16 so (79*4 bytes = 316 bytes ~= 0x200)
# RIOTBOOT_HDR_LEN can be set to 0x200
RIOTBOOT_HDR_LEN ?= 0x200

Expand Down
2 changes: 2 additions & 0 deletions dist/tools/compile_commands/compile_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ def generate_compile_commands(args):
# it's called -mlong-calls in LLVM, but we don't need it for clangd
# as we do not generate code anyway
'-mlongcalls',
# GCC specific diagnostics: Tell GCC address space starts at 0
'--param=min-pagesize=0',
]
_args.filter_out.extend(flags)
generate_compile_commands(_args)
14 changes: 9 additions & 5 deletions examples/suit_update/tests-with-config/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
IFACE = os.getenv("IFACE", "tapbr0")
TMPDIR = tempfile.TemporaryDirectory()

TRIGGER_RECEIVED_MSG = "suit_worker: started."
REBOOTING_MSG = "suit_worker: rebooting..."


def get_iface_addr(iface):
out = subprocess.check_output(["ip", "a", "s", "dev", iface]).decode()
Expand Down Expand Up @@ -94,6 +97,8 @@ def wait_for_update(child):

def get_ipv6_addr(child):
child.expect_exact(">")
# give the stack some time to make the address non-tentataive
time.sleep(2)
child.sendline("ifconfig")
if USE_ETHOS == 0:
# Get device global address
Expand Down Expand Up @@ -176,15 +181,15 @@ def running_slot(child):
def _test_invalid_version(child, client, app_ver):
publish(TMPDIR.name, COAP_HOST, app_ver)
notify(COAP_HOST, client, app_ver)
child.expect_exact("suit_coap: trigger received")
child.expect_exact(TRIGGER_RECEIVED_MSG)
child.expect_exact("suit: verifying manifest signature")
child.expect_exact("seq_nr <= running image")


def _test_invalid_signature(child, client, app_ver):
publish(TMPDIR.name, COAP_HOST, app_ver + 1, "invalid_keys")
notify(COAP_HOST, client, app_ver + 1)
child.expect_exact("suit_coap: trigger received")
child.expect_exact(TRIGGER_RECEIVED_MSG)
child.expect_exact("suit: verifying manifest signature")
child.expect_exact("Unable to validate signature")

Expand All @@ -194,7 +199,7 @@ def _test_successful_update(child, client, app_ver):
# Trigger update process, verify it validates manifest correctly
publish(TMPDIR.name, COAP_HOST, version)
notify(COAP_HOST, client, version)
child.expect_exact("suit_coap: trigger received")
child.expect_exact(TRIGGER_RECEIVED_MSG)
child.expect_exact("suit: verifying manifest signature")
child.expect(
r"SUIT policy check OK.\r\n",
Expand All @@ -205,11 +210,10 @@ def _test_successful_update(child, client, app_ver):
pass
# Check successful install
child.expect_exact("Install correct payload")
child.expect_exact("Install correct payload")

# Wait for reboot on non-native BOARDs
if BOARD != "native":
child.expect_exact("suit_coap: rebooting...")
child.expect_exact(REBOOTING_MSG)
# Verify client is reachable and get address
client = get_reachable_addr(child)
assert seq_no(child) == version
Expand Down

0 comments on commit 361328c

Please sign in to comment.