Duplicated Memory

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

Duplicated Memory

Jump to solution
527 Views
sebasira
Senior Contributor I

Hello everybody!

 

I'm having a strange problem which is blowing my brain out!!! I'm working with CW v6.1 and MCF51QE128... This program has a reserved memory for storing data in FLASH. I've just added a Bootloader to it, so I needed to redefine the LCF file. I did that and now this "thing" happens. The memory is or appears to be duplicated:

 

This is part of my LCF file:

 

MEMORY {

   userram     (RWX) : ORIGIN = 0x00800000, LENGTH = 0x00002000

   BootLoad    (RX)  : ORIGIN = 0x00000410, LENGTH = 0x000007F0

   VectorReMap (RX)  : ORIGIN = 0x00000C00, LENGTH = 0x00000400

   myflash     (RX)  : ORIGIN = 0x00001000, LENGTH = 0x00000400

   code        (RX)  : ORIGIN = 0x00001400, LENGTH = 0x0001EC00

}

 

  .userram     : {} > userram

  .code        : {} > code

  .BootLoad    : {} > BootLoad

  .VectorReMap : {} > VectorReMap

 

#  Code placement for bootloader section

  .text_bootload :

  {

  * (.text_bootload)

  . = ALIGN (0x4);

  } >> BootLoad

 

#  Code placement for remapped vector section

  .text_vectormap :

  {

  * (.text_vectormap)

  . = ALIGN (0x4);

  } >> VectorReMap


#  Code placement for data

  .myDATA : {

    *(.myDATA)

   } > myflash

 

 

 

Then in the xMAP:

 

# .text_vectormap

  00000C00 00000008 .text_vectormap StartupEntry (VectorMap.c)

  00000C08 00000008 .text_vectormap ISR_Vaccerr (VectorMap.c)

  00000C10 00000008 .text_vectormap ISR_Vadderr (VectorMap.c)

  00000C18 00000008 .text_vectormap ISR_Viinstr (VectorMap.c)

  00000C20 00000008 .text_vectormap ISR_Vdivz (VectorMap.c)

  00000C28 00000008 .text_vectormap ISR_VReserved6 (VectorMap.c)

  00000C30 00000008 .text_vectormap ISR_VReserved7 (VectorMap.c)

  00000C38 00000008 .text_vectormap ISR_Vprviol (VectorMap.c)

  00000C40 00000008 .text_vectormap ISR_Vtrace (VectorMap.c)

  00000C48 00000008 .text_vectormap ISR_Vunilaop (VectorMap.c)

  00000C50 00000008 .text_vectormap ISR_Vunilfop (VectorMap.c)

  00000C58 00000008 .text_vectormap ISR_Vdbgi (VectorMap.c)

 

# .myDATA

  00001000 00000001 .myDATA VAR1(file.c)

  00001001 00000001 .myDATA VAR2(file.c)

  00001002 00000001 .myDATA VAR3(file.c)

  00001003 00000001 .myDATA VAR4(file.c)

  00001004 00000001 .myDATA VAR5(file.c)

  00001005 000000A8 .myDATA VAR6(file.c)

  000010AD 00000004 .myDATA VAR7(file.c)

  000010B1 00000010 .myDATA VAR8(file.c)

  000010C1 00000014 .myDATA VAR9(file.c)

  000010D5 00000010 .myDATA VARA(file.c)

  000010E5 00000004 .myDATA VARB(file.c)

  000010E9 00000004 .myDATA VARC(file.c)

 

But, here's the strange thing, I load the code, and go to address 0x1020 (before running the MCU) and I found the EXACT same code from 0x0C20. Please, take a look at the attached Image... And please, if you think about a solution let me know, I can't go further from here!

 

Thanks in advance!!!

 

The way functions are place on text_vectormap is like :

#pragma define_section text_vectormap ".text_vectormap" far_absolute RX

__declspec(text_vectormap)void interrupt interrupt VectorNumber_INITPC StartupEntry(void){


And the way data is placed on myDATA is like:

#pragma define_section _myDATA ".myDATA" far_absolute R

#pragma explicit_zero_data on

__declspec(_myDATA) byte VAR1[FLASH_USUARIOS_dim];

 

 

 

 

 

SebaS

 

 

 

Labels (1)
Tags (3)
0 Kudos
1 Solution
333 Views
sebasira
Senior Contributor I

Well I manage to solve it after trial and error...

The solution was to move a portion of the LCF. like this:

.userram     : {} > userram

  .code        : {} > code

  .BootLoad    : {} > BootLoad

  .VectorReMap : {} > VectorReMap

#  Code placement for data

  .myDATA : {

    *(.myDATA)

   } > myflash

#  Code placement for bootloader section

  .text_bootload :

  {

  * (.text_bootload)

  . = ALIGN (0x4);

  } >> BootLoad

#  Code placement for remapped vector section

  .text_vectormap :

  {

  * (.text_vectormap)

  . = ALIGN (0x4);

  } >> VectorReMap

View solution in original post

0 Kudos
2 Replies
334 Views
sebasira
Senior Contributor I

Well I manage to solve it after trial and error...

The solution was to move a portion of the LCF. like this:

.userram     : {} > userram

  .code        : {} > code

  .BootLoad    : {} > BootLoad

  .VectorReMap : {} > VectorReMap

#  Code placement for data

  .myDATA : {

    *(.myDATA)

   } > myflash

#  Code placement for bootloader section

  .text_bootload :

  {

  * (.text_bootload)

  . = ALIGN (0x4);

  } >> BootLoad

#  Code placement for remapped vector section

  .text_vectormap :

  {

  * (.text_vectormap)

  . = ALIGN (0x4);

  } >> VectorReMap

0 Kudos
333 Views
sebasira
Senior Contributor I

But if someone could explain me why, it would be great!!!

0 Kudos