From: Jesus Calvino-F. <Je...@ec...> - 2006-03-28 15:44:32
|
An alternative is to define the variables inside the assembly: void version_data(void) _naked { _asm .area MY_VERSION (ABS) .org 0xaffe _MINOR_VESION: ; Notice the underscore before the label .db 0x01 .area CSEG (CODE) _endasm; } Area name CSEG is used after the .db, so to=20 properly concatenate relocatable areas with the=20 same name generated by SDCC. The variable can be=20 accessed anywhere in your code using: extern code unsigned char MINOR_VERSION; //Notice no underscore before the= name Jes=FAs At 03:52 AM 3/28/2006, you wrote: >Thanks, here's my final working version (I had to add another .area, >otherwise the rest of the file would be placed at wrong locations): > >void MINOR_VERSION_DATA(void) _naked > { > _asm > .area MY_VERSION (ABS) > .org 0xbffe > .db 0x01 > .area _CODE > _endasm; >} > >#define MINOR_VERSION (*(uint8_t *)((void *)(&MINOR_VERSION_DATA))) > >I still think that there should be a simpler and more elegant way to do >this though. >I can't try out the #pragma constseg solution suggested my martenbrook, >since I use the Debian packages, which don't include that feature yet. > >Philipp |