AnsweredAssumed Answered

C equivalent to ORG

Question asked by DSbob on Jun 1, 2007
Latest reply on Jun 4, 2007 by DSbob
Peg suggested I search for answers to my questions here, as the answers may be tool dependent.  OK, I'm using Codewarrior IDE v5.7.0, and just switched successfully from USB to demo board, to USB-Cyclone Pro-demo board (application hardware I designed arrives next week, but I've hooked a prototype to the demo board).   But I'm not sure of the terms.  In the 8-bit microcontrollers forum, I posted:
 
"I've spent years programming HC05 in asm.  New to C and Flash, using S08QG8.  I need to store a calibration value in flash.
 
With help from this forum [8-bit uC], I have it written to second to last page, 0xFC00.
 
Memory write protection starts at last page and works toward lower pages, right?  So with a flash writer in my application, I sure want to protect program memory! 
 
I want to write the calibration value at 0xE000, and make sure the complier/linker starts the application program at 0xE200, the second page of flash.  I've studied Segments and Sections in the linker prm file but don't see how to force that.  Any suggestions?
 
Writing this, I've come to realize each debug session will probably overwrite the calibration value through mass erase.  I think that can be delt with, have used command files.  Will a w(rite bytes, words, etc) post load command actually write to flash, so I can debug normal operation?"
 
Search terms "calibrate", "calibration", and "eeprom flash" turned up some interesting things, but I have not found anything specific to the compliler / linker, yet.
 
Thanks Alban for your reply in microcontrollers.  I'm a little confused about what is meant by "emplacement".  I think you are working with a different memory map too.  I'll be sure to study the QG8 memory map and flash page specs real close!  OK, I see the PLACEMENT part of the PRM file.  I think you are saying break the segment named ROM into ROMsomething and ROMsomethingelse (ROM1 looks like config register space or something).  Then the new INTO, maybe the #pragmas you suggest.  But the calibration value writer I adapted from the uC forum accepts an absolute address, and I was going to figure how to read the calibration value back that way (C pointer to absolute address?  In line assembly, MOV firstbyte, TPMC0VH, nextbyte to ...L?  If FFFF your erased, not calibrated!)
 
It is a simple application, perfect for finally forcing me to learn a little C.  Display peak absolute value of magnetic strength a hall sensor is exposed to, DC-400 hz, 0.1-1.5T.  Auto zero and normal operation are easy.  So should binary to LED segments conversion and multiplexing.  Self calibration-searching for sensor stimulation that measures strength of a DC calibration field, is the tricky part, but nearly operational.
 
I'll post a reply to this one, if I get into trouble!

Outcomes