I'm writing a bootloader for the PIC32MX, using HiTech's PICC32 compiler (similar to C90). At some point I need to jump to the real main routine, so somewhere in the bootloader I have
void (*user_main) (void);
user_main = (void (*) (void)) 0x9D003000;
user_main();
(Note that in the actual code, the function signature is typedef'd and the address is a macro.)
I would rather calculate that (virtual) address from the physical address, and have something like:
void (*user_main) (void);
user_main = (void (*) (void)) (0x1D003000 | 0x80000000);
user_main();
...but when I try that I get a compiler error:
Error #474: ; 0: no psect specified for function variable/argument allocation
Have I tripped over some vagarity of C syntax here?
This error doesn't reference any particular line, but if I comment out the user_main()
call, it goes away. (This might be the compiler removing a redundant code branch, but the HiTech PICC32 isn't particularly smart in Lite mode, so maybe not.)
Update: I notice also that if I use
void (*user_main) (void);
unsigned int x = 0x9D003000;
user_main = (void (*) (void)) x;
user_main();
I get the same error.