Initialization of such __code variables crashes a compiler with:
"Assertion failed: 0, file coff.c, line 100
This application has requested the Runtime to terminate it in an unusual way."
But all __data variables initializations work as expected.
Exemples (commented lines crash when uncommented):
__data char SramDataString[] = "Ala ma kota."; //string stored in ram, initiazlied from flash at init (like .data section)
__data char SramBssString[4]; //stored in ram but initialized with zeros if linked against crt0iz.
//__code char FlashString[]= "Kot nie ucieknie."; //string stored in flash. Crashes with SDCC 3.2
__data char* __data pInSramToStringInSram = &SramDataString; //Located in ram points to ram space
//__data char* __code pInFlashToStringInSram = &SramDataString; //Located in flash space points to data space No good for SDCC
__code char** __data pInSramToPointerterInFlash;// = &pInFlashToStringInSram;
__code uint16_t (* __data myfun[])(uint8_t) = { funA, //located in ram points to flash(3-byte address)
funB,
funC,
};
Remarks:
This is my first post in here (well, second as the first vanished). I have searched the sdccman, mailing lists and Discussion archives but no hints about __code were found.
Am I doing something wrong or is it a bug and I should report it somewhere?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Initialization of such __code variables crashes a compiler with:
But all __data variables initializations work as expected.
Exemples (commented lines crash when uncommented):
I use SDCC 3.2.0 #8008 MinGW
"C:\Program Files\SDCC\bin\sdcc.exe" --debug-ralloc --use-non-free --pstack-model=small --pcode-verbose --std-sdcc99 --debug -DNO_REG_OPT -I "D:\Documents\Projects\Common" -DDEBUG -L"C:\Program Files\SDCC\lib\pic16" libio18f4455.lib libc18f.lib -c -mpic16 -p18f4455 main.c -obuild/Debug/debug/main.o
Remarks:
This is my first post in here (well, second as the first vanished). I have searched the sdccman, mailing lists and Discussion archives but no hints about __code were found.
Am I doing something wrong or is it a bug and I should report it somewhere?
I have downloaded SDCC 3.3.0 RC3 #8604 and the above __code variables work as expected now!
Even function pointers located in flash that point to flash work fine:
Thanks!