This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How does the SoftDevice transfer control to the app at startup?

Hello,

I started with example apps and have got one working with the supplied makefiles, gcc, and Eclipse. I'm able to debug my code without trouble, and have succeeded in creating multiple BLE characteristics.

So I wanted to create an Eclipse "managed project" which creates its own makefile, and very carefully attempted to duplicate the behavior of the supplied makefile. I can successfully build, and the map file for the two projects is very similar. Not completely the same, because the build process is slightly different and the version of a couple gnu libs is newer than the other version (I am using the same linker scripts, though).

The problem is that when I try to run my code in the debugger, I can't even get to the breakpoint that gdb sets at main. I disabled the "continue" option in the debugger configuration so I could see the startup sequence more clearly. When the debugger starts up, the PC is set to 0x6d0, which seems to be in the SoftDevice, so it appears that the softdevice must transfer control to the app. But I have quickly realized that without an understand of how the softdevice (SD130) initially transfers control to the app, I can't get very far.

I consulted the softdevice documentation but I don't see this described anywhere.

Can someone shed some light on all of this?

Parents
  • When the soft device finishes init it looks at the application vector table which is at a known address (depending on the actual softdevice) and jumps to the reset handler. That simple.

  • How do I figure out what that "known address" is (for SD130)? From the map file of the app, I would guess the address is 0x1b000, which is the beginning of the FLASH section. The contents of location 0x1b000 is 0x800020. However, there is no executable code at 0x800020, and this doesn't correspond to any symbols in the .text section of the app makefile. So I have to conclude that the "known address" is not 0x1b000. This is all on the version of the code that works properly. Unless I can figure out how this works on the code which works properly, it is going to be hard to figure out why the non-working code is different. Is this documented anywhere?

Reply
  • How do I figure out what that "known address" is (for SD130)? From the map file of the app, I would guess the address is 0x1b000, which is the beginning of the FLASH section. The contents of location 0x1b000 is 0x800020. However, there is no executable code at 0x800020, and this doesn't correspond to any symbols in the .text section of the app makefile. So I have to conclude that the "known address" is not 0x1b000. This is all on the version of the code that works properly. Unless I can figure out how this works on the code which works properly, it is going to be hard to figure out why the non-working code is different. Is this documented anywhere?

Children
No Data
Related