reading from ROM and ROMON/ROMHM

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

reading from ROM and ROMON/ROMHM

2,020 Views
Adam
Contributor III
I have a mc9s12gc32 and have a few questions about it...

Can you read from this internal EEPROM area like you are reading from RAM? Meaning, 0xc000-0xfeff is page 3f and 0x4000-0x7fff (or 0x8000-0xbfff) is page 3e depending on how it is configured. If 0xc000 contains a 0x88, should I be able to run a program and read the 0x88 from 0xc000 by doing a simple instruction or line of c like:

data = *((byte *)(0xc000));

Next, I have external devices that require me to set up the CPU with ROMON and ROMHM so that page 3e normally at 0x4000-0x7fff map to 0x8000-0xbfff. So I configured code warrior to put all of default_rom into page_3e in the prm. Should be straight forward. However, when I look at the debugger, there is no data listed for 0x8000-0xbfff just all 0x00. But 0x3e8000 does contain the ROM.

LAST, I've noticed that when I have two ROM spaces broken up into page 3e and 3f, I have all nonbanked stuff and entry in 3f, and I put other code into 3e, but if nothing from the 3f page ever calls code in 3e, the code in 3e doesn't seem to load into the EEPROM. Why is that?

Which could lead me to my whole problem, if I am expecting code to be in 0x8000, but it isn't code I've called before, will 3e not be mirrored into 0x8000?

======================================================
Basically, what I am trying to do is build a simple program to live in 0xc000 and with this another program gets built and copied into 3e. But the program that runs doesn't call any of the code in 3e, it simply copies all of 3e into an external EEPROM device. But if I can never get to the code that is supposedly in page 3e, then I can't reliably copy to external eeprom.

Any advice?
Labels (1)
0 Kudos
3 Replies

439 Views
sjmelnikoff
Contributor III


Adam wrote:

Can you read from this internal EEPROM area like you are reading from RAM?


I presume in this case that you mean flash, rather than EEPROM? The answer is, yes - as long as the data is in unpaged flash (i.e. 0x4000-0x7FFF or 0xC000-0xFFFF).

Normally, constants are stored in flash anyway (check the map file to make sure, and if not, there's an option to enable it), so if that is the data that you are accessing, there's no need to use pointers at all.


Adam wrote:

However, when I look at the debugger, there is no data listed for 0x8000-0xbfff just all 0x00. But 0x3e8000 does contain the ROM.


I've seen this too. I'm not sure if there's anything you can do about that.

Steve M.

0 Kudos

439 Views
Ilocano
Contributor I
I had the same issue before too.

If your code in $C000 is not calling a program in $8000 then it will be optimized out.

So I what I do is do a dummy call at a function within $8000 so that CW will link it during compilation.
0 Kudos

439 Views
Steve
NXP Employee
NXP Employee
There is also a CodeWarrior Linker command called ENTRIES that forces the linker to include specific elements.
0 Kudos