Closed japaric closed 3 years ago
b. read the
.vector_table
linker section and extract the 'initial SP pointer' value
Hi @japaric, I am struggeling to figure out how to extract the initial stack pointer from the .vector_table
. Can you please give me a pointer for this?
Answer: It is the first 32-bit word in that section. Documented in the ARMv6-M Architecture Reference Manual.
CI compiles the
test-flip-link-app
(binary) crate to the ARM Cortex-M architecture as an 'it links' test.We should extend this test and also check that the memory layout of the output ELF is indeed "flipped".
Steps:
object
crate to parse the output ELF.vector_table
linker section and extract theinitial SP pointer
valuestatic RAM
(the.bss
,.data
and.uninit
linker sections)initial SP pointer
(2) should be lower/smaller than the lowest boundary ofstatic RAM
These steps could be done in a test file in the root (e.g.
test/verify.rs
): the test function would build the test-app and then verify its memory layout. Thiscargo test
will run the unit tests insrc/main.rs
as well as this new test.