Unable to use AHB Sram when Global Data Placement is not set to default (LPC4357)

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

Unable to use AHB Sram when Global Data Placement is not set to default (LPC4357)

673 Views
uaz
Contributor II

Hi,

I tried to change the managed linker script option to fully use my SRAMs. I found out that I'm unable to place data in AHB Sram (RAM3) even when using __DATA() macro. This is the situation:

=> INITIAL when my data is correctly placed in RAM3:

1. My memory configuration:

memory-configuration.JPG

2. My linker setting:

before-linker-script.JPG

3. Compilation result is correct, my 12KB data is in RamAHB32:

before-memory-consumption.JPG

=> AFTER I Changed the Global data placement setting:

1. My linker setting:

new-managed-linker-script.JPG

2. The new compilation result where my data is placed into RAM instead of RAM3:

memory-after-changing-linker.JPG

Would appreciate if anyone could point my mistake. Here is my test source code:

#include "chip.h"

#include <cr_section_macros.h>
#include <stdint.h>

static volatile __DATA(RAM3) uint8_t ucLwipHeap[12000];

int main(void) {
 SystemCoreClockUpdate();

 ucLwipHeap[0] = 123;
 ucLwipHeap[5] = 99;

 volatile static int i = 0 ;
 while(1) {
 i++ ;
 }
}

Thanks in advance,

UAZ

0 Kudos
2 Replies

553 Views
lpcxpresso_supp
NXP Employee
NXP Employee

I don't think you have done anything wrong as such, but it does look like you have encountered an interesting quirk in the way that changing the global data placement region in the managed linker script can interact with the __DATA() macro.

Two possible ways to "workaround" this issue would be to do either of the following:

  1. Rather than changing the region to use for global data in the managed linker script tab of project properties, use the Memory Configuration Editor (in the project's MCU settings) to reorder the RAM - the RAM bank that you place first in the list will be used as the default location for placing global data.
  2. Rather than using __DATA(RAM3) instead use __DATA(RamAHB32)

Regards

MCUXpresso IDE Support

0 Kudos

553 Views
uaz
Contributor II

Hi,

I did the first workaround and it worked. The latter did not help.

I think I know the real issue here. Global Data MUST be configured to default, in order to be able to use custom data placement. So we just need to make sure to reorder the RAM configuration so that Global Data can be configured as Default.

Regards,

UAZ

0 Kudos