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.
Hi, I'm confused about the existings threads regarding this topic, so please excuse this new thread. I'd like to put some calibration data into my (OTP) memory of C164-CA. The software would have some declaration for a few constants located at the end of the code space for example. These constants would get their value coded to zero for example. Before burning the otp the real calibration data would be placed into the programmers hex-file by modifying the selected values. Does anybody have an idea of how to place these constants to a fixed location in memory ? Thanks in advance Thomas
By following the advice described in the knowledgebase article I'm able to redirect the const variable to a specific address in the NCONST segment. I have the impression that the variable itself is located to a RAM address, whereas only the value for initialisation is placed into ROM and loaded into the RAM variable at startup. Is there a possibility to make the compiler only address the ROM when reading this constant ? I would like to save the extra RAM space ...
Just to see if it works I did the whole thing myself. Created the file test.c and included it in the project:
const int i=0x1234; void main(void) { static int huge* ptr; ptr = &i; }
?NC?TEST%NCONST(0x000300)
MAP file: START STOP LENGTH TYPE RTYP ALIGN TGR GRP COMB CLASS SECTION NAME ===================================================================================== ... 000300H 000301H 000002H DATA REL WORD --- 3 PUBL NCONST ?NC?TEST ... Intel HEX file: ... :020300003412B5 ... Disassembly of main(): 00020000 E6F40003 MOV R4,#0x0300 00020004 E6F50000 MOV R5,#0x0000 00020008 F6F40012 MOV DPP0:0x1200,R4 0002000C F6F50212 MOV DPP0:0x1202,R5 00020010 CB00 RET