Hi,
i have this doubt, the map file is in local memory map and the hex file generated is in global memory map. So, it is little bit
confusing to corss verify both of them.
So first question is can i generate a map file in the global format?
Next i want to convert from the local to the global and from global to local i am trying with this following conversion
of the address information as attched in the document from the datasheet.
Ex: 0xE18000 - 0x784000
local memory:
0xE18000
ppage: 0xE1
offset: 0x8000
offset: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
take the bits from 13 to 0:
0 0 0 0 0 0 0 0 0 0 0 0 0 ( iam missing out on bits 1 and 0)
ppage: 0xE1
1 1 1 0 0 0 0 1
global address:(1+ ppage+ local address)
1 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
=0x784000
Now i am trying to convert the global address to local memory but in the global address map we have eliminated two bits. How to
get those two bits. Are they not required
0x784000 to local memory map ?? Please help me.
Hi rahul,
For HCSX MCU, CW generate s19 and glo file. these two files are automatically generated after a successful build in your project "bin" folder. please take a look at this folder.
s19 file use logical address.
glo file use global address.
does this answer your questions?
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Excellent. Yeah i can understand something. I am using hexview to actually view these files. I am trying to figure out as i said in my first mail what happened to those 2 bits.
Hi,
Here are the function which you can use to convert addresses to global and back to logical:
//==============================================================================
// Convert data address format from 0xPPAGE~offset to the global address format 0xGPAGE~offset
// Conversion flow:
// Addr - function: 0000 0000 pppp pppp ffff ffff ffff ffff
// 1111 1198 7654 3210 7654 3210
// || 5432 10
// \/
// Global addr : 1 PPAGE Register [7:0] Address [13:0]
//
// : 0000 0000 01pp pppp ppff ffff ffff ffff
// 76 5432 1011 1198 7654 3210
// 32 10
//==============================================================================
unsigned long int ConvertPPageOff2Global(unsigned ling int Addr)
{
Addr = ((Addr>>2) & 0x003FC000UL) | (Addr & 0x00003FFFUL) | 0x00400000;
return(Addr);
}
//==============================================================================
// Convert data address format from global address format 0xGPAGE~offset to the
// format 0xPPAGE~offset
// It is made because compiler uses global addressing (GLY, GLAB) for far data access.
// Conversion flow:
// Global addr : 1 PPAGE Register [7:0] Address [13:0]
//
// || : 0000 0000 01pp pppp ppff ffff ffff ffff
// \/ 76 5432 1011 1198 7654 3210
// 32 10
// Addr - function: 0000 0000 pppp pppp ffff ffff ffff ffff
// 1111 1198 7654 3210 7654 3210
// 5432 10
//==============================================================================
unsigned long int ConvertGlobal2PPageOff(unsigned long int Addr)
{
Addr = ((Addr<<2) & 0x00FF0000UL) | (Addr & 0x00003FFFUL);
return(Addr);
}
//==============================================================================
Moreover, you might want to read an appnote about S12X memory scheme - AN3784:
http://cache.freescale.com/files/soft_dev_tools/doc/app_note/AN3784.pdf
Also, in the CodeWarrior installation folder on your PC, find Help PDFs. There are some Technical Notes (TNxxx) you might like to read.
Hi iggi,
Thank you so much for the detailed mail and the source code.