I am doing a bootloader to support updates via ESB. I am using MicroLib. I am not using SoftDevice.
My project mapping:
Bootloader 0x0000-0xBFF Application Vector Table 0xC00 Application 0x1000-0x7FFF
My bootloader pulls the reset vector out of the Application Vector Table and successfully starts the Application. I also am processing interrupts by doing a jump in my bootloader to the appropriate address in the Application Vector Table per other examples found on the Forum. My problem is that I had to disable all of the ESB calls to get the application to run. I see addresses to nrf_impala routines in the Application Vector Table. How do I handle these to properly initialize ESB (and anything else I am missing)? My guess is that the initialization/library installation is normally done by __main(). I jump directly to main() in my application since the application vector table is at the wrong spot, so __main() crashes in my application. I don’t want to overwrite my original vector table for safety reasons.
I am following the example from this post devzone.nordicsemi.com/.../.
I have verified that my bootloader transfers to the application and correctly processes the interrupts. All of my variables are zero-initialized. I modified my arm_startup_nrf51.s routine to set all RAM to 0. I copied my hex file from page 0 of the application below. I am trying to understand what all the values are from 0xC0 - 0x1F8. I assume that these are used by __main. Some initialize static/global variables ( I have handled this ). The others appear to be addresses. I don't know how to deal with these. Is there source code for __main() available?
Any suggestions? I am hoping this is a common problem that has already been solved. I haven’t been able to find an appropriate example anywhere on the Forum. I have attempted to decipher the initial section below.
Vector Table [DONE] :1000000000400020E1100000F5100000F710000093 :1000100000000000000000000000000000000000E0 :10002000000000000000000000000000F9100000C7 :100030000000000000000000FB100000FD100000A8 :10004000FF10000091390000FF100000FF100000B9 :10005000FF1000000000000041430000FF100000FE :10006000FF100000FF10000023360000495300007D :10007000FF100000FF100000FF100000FF10000044 :10008000FF100000FF100000FF100000FF10000034 :10009000413C0000FF100000FF100000FF100000B6 :1000A000FF100000FF100000000000000000000032 :1000B0000000000000000000000000000000000040 End of Vector Table
:1000C000 034885460 0F006F8 00480047 6D600000 D0 46854803 ?? F806F000 ?? 47004800 ?? 0000606D main() in application - handled in ARM_startup_nrf51 - jump to main instead of __main :1000D000 00400020 064C0125 064E05E0 E36807CC F1 20004000 Top of RAM 25014C06 ?? E0054E06 ?? CC0768E3 ?? :1000E000 2B430C3C 98471034 B442F7D3 FFF7ECFF 96 3C0C432B ?? 34104798 ?? D3F742B4 ?? FFECF7FF ?? :1000F000 18010000 48010000 02E008C8 121F08C1 F2 00000118 ? address 118 has 148 in it ? 00000148 Start address of .data initialization section C808E002 ?? C1081F12 ?? :10010000 002AFAD1 70477047 002001E0 01C1121F 98 D1FA2A00 ?? 47704770 ?? E0012000 ?? 1F12C101 ?? :10011000 002AFBD1 70470000 48010000 00010020 C8 D1FB2A00 ?? 00007047 ?? 00000148 Start of .data initialization section 20000100 Start of Application RAM (.data is at start) [DONE] :10012000 4C000000 F8000000 94010000 4C010020 89 0000004C ?? 000000F8 ?? 00000194 End of this section of hex file 2000014C Start address of .bss section [DONE] :10013000 E8060000 08010000 94010000 00300020 E3 000006E8 Length of .bss section 00000108 ?? 00000194 End of this section of hex file 20003000 Start of stack [DONE] :10014000 00100000 08010000 0024F400 00000000 7E 00001000 Size of stack [DONE] 00000108 ?? 00F42400 Start of initialized variable data 00F42400 Used by System_Nrf.o (4 bytes) - SystemCoreClock - Not used in application [IGNORE]
:10015000000000000000000000000000000000009F :10016000000000000000000000000000000000008F :10017000000000000000000000000000000000007F :1001800000000000000000000000000067240000E4 :04019000F128000052 [PROBLEM] 20000140 => 40 + 148 = 188 .data 0x20000140 Section 12 nrf_state_machine.o(.data) :0801F000 67240000 F1280000 63 nrf_impl_state_fun_timeslot_start 0x00002467 Thumb Code 1162 nrf_impala.o(.text) nrf_impl_state_fun_device_send_packet 0x000028f1 Thumb Code 74 nrf_impala.o(.text) End of initialized variable data