amohr 0 Posted March 24, 2003 Report Share Posted March 24, 2003 Hobknob made a post in the topic "Default value in EE " in the "C programming with C2C-plus compiler" forum with the following example: ////////// asm last_addr equ $ ; save current address for assembly asm org 0x2100 ; Eprom address when programming PIC asm dw 12,34,56,78 ; set our bytes in eprom - only when programmed! asm org last_addr ; restore current address for assembly to contniue as normal /////////// to allow users to write specific data to flash memory when programing your device. The reason why I want to do this is because I want to be able to overwrite specific portions of memory through a bootloader w/o having to write assembly. so when I added the above code to my program I get the following error: Warning: Not known opcode 'dw 12,34,56,78' asm error: Location of '0' already occupied or not valid asm error: Location of '0' already occupied or not valid Warning: Timing in '_delay_ms' is wrong because of extra 'page' instructions Warning: Timing in '_delay_ms' is wrong because of extra 'page' instructions Warning: Timing in '_delay_ms' is wrong because of extra 'page' instructions Warning: Timing in '_delay_ms' is wrong because of extra 'page' instructions Quote Link to post Share on other sites
amohr 0 Posted March 24, 2003 Author Report Share Posted March 24, 2003 neat, it worked! thanks! Quote Link to post Share on other sites
amohr 0 Posted March 24, 2003 Author Report Share Posted March 24, 2003 so originally it worked (by moving the assembly to the end of the file), but now that my code just grew by a little bit I'm getting the error again I just thought of a way to get around this. Let me know if I can make the following assumption: I can declare char[] arrays globally in my C code, and then watch where PicAnt places these arrays by looking at the lst file, and then overwrite these memory locations through a bootloader. This sounds like it will work as long as PicAnt uses contiguous blocks of memory for the character arrays I create in my C code. Another thing: the PIC16f877 uses 14bit words right? Is there any way I can access this size variable through C ? Quote Link to post Share on other sites
Guest Pavel Posted April 23, 2003 Report Share Posted April 23, 2003 The 5.0.5 compiler version has a new pragma that reserves data in code or eeprom memory. Unfortunately this change wasn't added to the compiler help file. Help update is available to download here. Regards, Pavel Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.