I have built two code images on my LPC11U68, one that resides in Flash based at 0x00000000 and one that's based at 0x00005000.
The one at 0x00000000 takes care of all the vector stuff. The idea is for some code in the 0x00000000 space (lower space) to call some of the functions located in the 0x00005000 space (higher space). Each function in the higher space is located at a known fixed address as specified by assigning a section in the linker script for each function. I am able to confirm that these functions are in flash where they should be.
What I'm finding is that when (from the lower space) I attempt to call one of the functions in the higher space it fails.
First, I create and initialize a function pointer as follows:
#define FUNCTION_ADDRESS_IN_FLASH 0x00005000
volatile void (*GoToHigherFunction)( void ) = (void *)(FUNCTION_ADDRESS_IN_FLASH + 1);
Then I call the function like this:
If I use the exact same code, but specify an address within the Lower Code Build (e.g. #define label to 0x00001000) it works fine.
Because the code is from two separate builds, I am only able to debug the code in the Lower Space using my LPCXpresso Board and the IDE. All the code in the Lower Space works fine, I can single step right up to the call to the function located at 0x5000, but when I single step into the function it goes off into never never land. Using the debugger, right before the call, I can confirm that the function address is correct (0x5000) and from the debugger I can also view flash memory and confirm that the code is right there at 0x5000 as it should be, but I am unable to call that function for some reason.
I though maybe it was because I was using the debugger which didn't have info about the code in the higher space, but even if I make Release builds and burn the ".bin" files directly into flash (not using the debugger at all) it still doesn't work.
I am using the LPCXpresso IDE v7.6.2_326 on Windows 7 with an LPCXpresso LPC11U68 Board for debugging my target which is also an LPC11U68.
I have looked at the code space in memory, everything's right where it belongs, but I am unable to make function calls to code generated by the second build located in the higher space.
This seems very odd to me - can anyone help me understand why this won't work?