Placing a variable at a particular in a PAGED ADDRESS Location.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Placing a variable at a particular in a PAGED ADDRESS Location.

1,316 Views
Nycil
Contributor I

Hello All,

I need to place a variable,say, CalculateCRC_u32 variable at paged location in the ROM. I have specified an address range

APPLN_PAGE_PROG_FLASH_EF       = READ_ONLY   DATA_FAR IBCC_FAR  0xEF8004 TO 0xEFBFFF;

in my linker.

I need to place this variable in the address location 0xEF8004(logical address). Its unsigned integer variable and CANNOT be a const. I need to place this variable @ address 0xEF8004, so that it appears in the S19 file as a separate record. I need to alter the data in this Srecord , so that I get the changed data in my application which is flashed into an S12XEP100.

Thanks In Advance..

Labels (1)
0 Kudos
Reply
6 Replies

754 Views
CompilerGuru
NXP Employee
NXP Employee

Either use 0xEF8004 as part of APPLN_PAGE_PROG_FLASH_EF or allocate a variable with @ at this address, but don't use the same address twice.

 

It's also unclear to me why the var at 0xEF8004 must not be const. As this address is in flash I would expect it to be const. If you don't want anything at 0xEF8004, then don't place a (non const) variable there but instead use a macro like

#define CalculateCRC_u32  (*(const unsigned long*)0xEF8004)

to read the 4 bytes from that address.

 

Daniel

0 Kudos
Reply

754 Views
J2MEJediMaster
Specialist I

This sounds similar to stuffing an identifying serial number into flash memory question. Check out FAQ-28651 and see if this information can help you.

 

---Tom

 

0 Kudos
Reply

754 Views
kef
Specialist I

Try this link to FAQ-28651

0 Kudos
Reply

754 Views
kef
Specialist I

Tom, there's a problem with links to FAQ items. If you open what is suggested by search engine, /usually long internet address/, it opens, but then promptly long address in the address bar is halved. This short address points to valid location only if you opened long address after last start of explorer, it doesn't work if IE is closed/reopened.

0 Kudos
Reply

754 Views
Nycil
Contributor I

Thanks Tom and Kef.

When I did that I got an S Record that starts with the address which I had specified along with the @ pointer. I then opened the S19 File, and modified the data field of the S record and also placed the appropriate checksum at the end of the record. When I flashed the S19 file into the microcontroller(S12XEP100), and tried reading the value from the address(whose data I had edited), I am getting the older value itself instead of the new  one that I had written into the S19. Is there any way to edit the data of an Srecord and get that edited data after flashing into the microcontroller.

 

My actual requirement is as follows. I have a Tool which parses the S19 file and finds CRC of the whole data present in the S19 file. This CRC value is taken by the tool and written into an S record that has to be created specifically for it.I need to access this CRC from the address location into which it has been written into during runtime and compare it with the value of the CRC that will be generated by the CRC module of my application.

 

 

0 Kudos
Reply

754 Views
CompilerGuru
NXP Employee
NXP Employee

Hi,

 

I'm wondering why you write any value to that address in the C code, for a checksum to be added as srecord I would instead just not define anything at that address range. So the SRecord's of the app would not cover that address and the srecord for the CRC can be simply appended to the file (well after dropping the last S9 record maybe).

 

Another item which is not clear to me is how you program the flash. Note that by default when using hiwave, the elf file (with extension .abs) is flashed, not the srecords. Maybe this is why you end up seeing the old value in memory? Do you flash the elf? Writing the address into the ELF file would also be a possibility, srecords can still be generated with the ELF afterwards if needed.

 

Daniel

 

0 Kudos
Reply