We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Does anyone knows a methode, to declare a const struct in code-space at a specific CODE address in C51? Background: I use a philips 87LPC767-MC and i want to store some code-revision-info in the 32Byte customer code space. I will define a C-Structure like typedef struct { unsigned char uc_software_code; unsigned char uc_main_version; unsigned char uc_sub_version; unsigned long ul_checksum; } CodeRefInfo_ts; CodeRefInfo_ts tsCodeRefInfo= { 0x04, 0x01, 0x01, 0x012345678 } at 0xFC0E; But it seems it is not possible to use the at-Keyword to locate a struct in the codespace?! Any suggestion? Thanks Markus
Hi Markus: This works for the C166. I use an assembly file and specify the start address with the CODE AT or ORG statements.
public CRC public ST_ADDR public ED_ADDR public PART_NUMB INFO_TAB SECTION CODE AT 0A000H INFO_PROC PROC CRC: dw 0432fH ST_ADDR: dw 00000H dw 04000H ED_ADDR: dw 00001H dw 0FFFFH org 0A010H PART_NUMB: db "123456-002-05", 0 INFO_PROC ENDP INFO_TAB ENDS END
That's right, the _at_ directive cannot take initialized variables. E.g. you can place an object somewhere using the compiler (a weird concept since the linker is usually told to do such things) but you cannot assign the object an initial value. As previously noted, assembler is the way to do this. - Mark