Ion-Mobility / tock

A secure embedded operating system for microcontrollers
https://www.tockos.org
Other
0 stars 0 forks source link

S2k14x memory layout #2

Closed 0xkelvin closed 1 year ago

0xkelvin commented 1 year ago

Hello @xobs @nguyenlkdn

could you please review this configuration https://github.com/Ion-Mobility/tock/blob/f/add_new_chip_s32k144/boards/s32k144_evb/layout.ld

xobs commented 1 year ago

Some things to note:

  1. Modify https://github.com/Ion-Mobility/tock/blob/f/add_new_chip_s32k144/boards/kernel_layout.ld and insert a .fcf region in the correct place. You can see this being done in https://github.com/Ion-Mobility-Systems/gridania-bringup-dvt1/blob/main/148/ld/s32k148.ld#L26 and https://github.com/Ion-Mobility-Systems/gridania-bringup-dvt1/blob/main/148/ld/s32k148.ld#L94-L98
  2. Strip out some amount of data from ROM and write a small bootloader at the start. That is, offset 0 will be your stack pointer and offset 4 would be your entrypoint. Then write a bootloader starting at offset 8 that just does the following:

That way the first chunk of memory is unused.

The problem with (2) is that I'm not sure what the alignment requirements are of VTOR. If you can set it to 0x500, then that's much better than if it needs to be set to 0x1000.