cpu/kinetis: fix values stored in ROM_LEN/RAM_LEN variables#10888
cpu/kinetis: fix values stored in ROM_LEN/RAM_LEN variables#10888aabadie merged 1 commit intoRIOT-OS:masterfrom
Conversation
|
This issue was referenced in #10857
It is not expected to be in `KB, it is just that we handle it when it is defined as 512K or something. However I still do not get why we have an error when it is defined as I somehow remember issues while defining values only as |
f768eee to
8df4ac0
Compare
|
Change this PR with another fix as discussed IRL with @cladmi |
|
I really do not like having to add a subshell here for an unknown reason. Does it work if you just remove the spaces inside the parentheses and keep the whole thing as it is in master? The spaves might have messed up the processing in the other place. |
The problem is because we need to perform the variable expansion before the replacement that is done on it for computing the SLOT0_LEN here. This SO answer mention that the
I tried and it doesn't make any difference. Another potential fix is to use the shell command when evaluating the value of ROM_LEN here. |
|
The reason why it would be needed to change to It was not the case before but now ROM_LEN is used and evaluated from within the makefiles so is supposed to be a variable with a valid value. It is currently not needed for The simplest solution would be to do Another solution, would be to change |
|
I could run diff --git a/cpu/kinetis/Makefile.include b/cpu/kinetis/Makefile.include
index a5f36b4ed..7d60f9c22 100644
--- a/cpu/kinetis/Makefile.include
+++ b/cpu/kinetis/Makefile.include
@@ -13,7 +13,10 @@ LINKER_SCRIPT = kinetis.ld
ROM_START_ADDR = 0x00000000
RAM_BASE_ADDR = 0x20000000
RAM_START_ADDR = $$(($(RAM_BASE_ADDR)-($(KINETIS_SRAM_L_SIZE) * 1024)))
-ROM_LEN = $$(($(KINETIS_ROMSIZE) * 1024))
+# Define ROM_LEN with a non arithmetic value as it must be
+# evaluated in `cortexm_common` without a shell context
+# The `K` is correctly handled by both the linker and `cortexm_common`.
+ROM_LEN = $(KINETIS_ROMSIZE)K
RAM_LEN = $$(($(KINETIS_RAMSIZE) * 1024))
CFLAGS += \ |
|
It is also not showing errors anymore: In master they all have the |
|
And even more, now that I had test to report. The Setup: The output is the same with the |
8df4ac0 to
32cc764
Compare
|
@cladmi, thanks and sorry for the long delay. I confirm your solution works. If it's fine for you, I'll drop the initial commit and the revert one from this PR. |
It must be evaluated in `cortexm_common` without a shell context. The `K` is correctly handled by both the linker and `cortexm_common`. Co-authored-by: Gaëtan Harter <[email protected]>
236ec3c to
e089b1e
Compare
|
@cladmi: I integrated your comment into this PR (and you are now co-author of the commit). Let me know what you think. |
|
Thank you I will retest |
cladmi
left a comment
There was a problem hiding this comment.
Reviewed and tested with frdm-k64f frdm-kw41z and pba-something.
|
All green, let's go! |
|
Thanks for handling this one. |
|
Thanks for proposing a better fix than the one initially proposed ;) |
Contribution description
This PR is fixing a failure with kinetis cpus when building any application. This failure is not blocking the generation of firmwares though.
There is this error displayed in the terminal:
/bin/sh: 1: Syntax error: Missing '))'. This error is generated when reaching this line.This is because the way the ROM_LEN is determined breaks the computation of the SLOT0_LEN variable used for the bootloader. For SLOT0_LEN, the ROM_LEN is expected to be in KB by default.
For consistency, the RAM_LEN is computed the same way.
I put the RFC label, because I'm not 100% sure whether this is the best fix or not.
Testing procedure
make -C tests/periph_adcYou get this:
/bin/sh: 1: Syntax error: Missing '))'Issues/PRs references
Referenced in #10857