XMC4500 memory problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,

My target is the Hitex XMC HiLight board which is XMC4500F144x1024 so I though I should be OK up to 0x100000 bytes of flash However when I construct a simply program that goes beyond 0x3FFFF I end up with a bus fault.

I've constructed the simplest example I can think of, flashing one LED


#include //Declarations from DAVE3 Code Generation (includes SFR declaration)

#define RED_LED_HANDLE IO004_Handle0

/* This value is OK */
static const char dummyArray[0x3DFFF] = { };

/* This value fails */
//static const char dummyArray[0x3EFFF] = { };

void delay()
{
int i;

for (i=0; i<10000000; i++)
{
}
}

int main(void)
{

DAVE_Init(); // Initialization of DAVE Apps

while(1)
{
IO004_TogglePin(RED_LED_HANDLE);
delay();
}
return 0;
}



Am missing something obvious like a linker option?

Best regards,

Andy
0 Likes
3 Replies
oreste
Employee
Employee
Welcome! 50 replies posted 25 replies posted
Hi Andy,
I have just tried on my Hexagon board with the same device.
I have no problem with 0x3EFFF.
Actually I don't have an Hitex board.
Could you attach the linker script ?
In attachment mine.

/* Generated Linker Script file */
/*
* Template Version 1.0 dated 11 Oct 2012
*/

OUTPUT_FORMAT("elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(__Xmc4500_reset_cortex_m)
GROUP(-lxmclibcstubs)

MEMORY
{
FLASH_1_cached(RX) : ORIGIN = 0x08000000, LENGTH = 0x100000
FLASH_1_uncached(RX) : ORIGIN = 0x0C000000, LENGTH = 0x100000
PSRAM_1(!RX) : ORIGIN = 0x10000000, LENGTH = 0x10000
DSRAM_1_system(!RX) : ORIGIN = 0x20000000, LENGTH = 0x10000
DSRAM_2_comm(!RX) : ORIGIN = 0x30000000, LENGTH = 0x8000
}

stack_size = 2048;

SECTIONS
{
/* TEXT section */

.text : AT(ORIGIN(FLASH_1_uncached))
{
sText = .;
*(.Xmc4500.reset);
*(.Xmc4500.postreset);
*(.XmcStartup);
*(.text .text.* .gnu.linkonce.t.*);

/* ARM <->THUMB interworking */
*(.glue*)
*(.v4*)
*(.vfp11_veneer)

/* C++ Support */
KEEP(*(.init))
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
KEEP(*(.fini))
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;

KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))

/* Exception handling support */
__extab_start = .;
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
__extab_end = ABSOLUTE(.);
} > FLASH_1_cached

/* Exception handling, exidx needs a dedicated section */
.ARM.exidx ABSOLUTE(__extab_end): AT(__extab_end | 0x04000000)
{
__exidx_start = .;
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
. = ALIGN(4);
__exidx_end = ABSOLUTE(.);
} > FLASH_1_cached

/* CONST data section */
.rodata ABSOLUTE(__exidx_end): AT(__exidx_end | 0x04000000)
{
*(.rodata .rodata.*)
*(.gnu.linkonce.r*)
} > FLASH_1_cached

. = ALIGN(16);

/* End of RO-DATA and start of LOAD region for DATA */
eROData = . | 0x04000000;

/* DSRAM layout (Lowest to highest)*/
/* Fully Descending Stack <-> BSS <-> DATA <-> HEAP */
/* Dummy section for stack */
Stack (NOLOAD) :
{
. = . + stack_size;
__Xmc4500_stack = .;
} > DSRAM_1_system

Communication_Buffers :
{
*DMA_Descriptors.o (COMMON);
} > DSRAM_2_comm

/* BSS section */
.bss :
{
__Xmc4500_sBSS = .;
* (.bss);
* (.bss*);
* (EXCLUDE_FILE(*DMA_Descriptors.o) COMMON);
*(.gnu.linkonce.b*)
__Xmc4500_eBSS = ALIGN(4);
} > DSRAM_1_system
/* Yes, the size must be kept outside */
__Xmc4500_BSS_Size = __Xmc4500_eBSS - __Xmc4500_sBSS;

/* Standard DATA and user defined DATA/BSS/CONST sections */
.data ABSOLUTE(ALIGN(16)): AT(eROData)
{
__Xmc4500_sData = .;
* (.data);
* (.data*);
*(*.data);
*(.gnu.linkonce.d*)
__Xmc4500_eData = ALIGN(4);
} > DSRAM_1_system
/* Yes, the size must be kept outside */
__Xmc4500_Data_Size = __Xmc4500_eData - __Xmc4500_sData;

/* Heap - Bank1*/
__Xmc4500_heap_start = ALIGN(8);
__Xmc4500_heap_end = ORIGIN(DSRAM_1_system) + LENGTH (DSRAM_1_system);
Heap_Bank1_Start = __Xmc4500_heap_start;
Heap_Bank1_Size = __Xmc4500_heap_end - __Xmc4500_heap_start;
Heap_Bank1_End = ABSOLUTE(__Xmc4500_heap_end);

/* Heap - Bank2 */
DSRAM2_Heap :
{
/* To host DATA in DSRAM2 above heap, please be sure to augment
* program loader code in the startup file */
Heap_Bank2_Start = .;
} > DSRAM_2_comm
Heap_Bank2_Size = LENGTH(DSRAM_2_comm) - (Heap_Bank2_Start - ORIGIN(DSRAM_2_comm));

/* Heap - Bank3 */
PSRAM_Heap :
{
/* To host DATA in PSRAM above heap, please be sure to augment
* program loader code in the startup file */
Heap_Bank3_Start = .;
} > PSRAM_1
Heap_Bank3_Size = LENGTH(PSRAM_1) - (Heap_Bank3_Start - ORIGIN(PSRAM_1));

/DISCARD/ :
{
*(.comment)
}

.stab 0 (NOLOAD) : { *(.stab) }
.stabstr 0 (NOLOAD) : { *(.stabstr) }

/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }

/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }

/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_pubtypes 0 : { *(.debug_pubtypes) }

/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }

/* DWARF 2.1 */
.debug_ranges 0 : { *(.debug_ranges) }

/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }

/* Build attributes */
.build_attributes 0 : { *(.ARM.attributes) }
}



0 Likes
lock attach
Attachments are accessible only for community members.
Not applicable
Hi oreste,

My linker script is identical to yours.

I have attached the entire project, maybe you can see some other problem?



Kind regards,

Andy
0 Likes
Not applicable
Hi,

I just remembered I have a Relax Lite board.

The code works fine on the Relax Lite board (having changed the IO004 assignment to P1.0).

Since P1.0 just goes to a header on the HiLight board I then tried the same code on the HiLight board and the code does not work.

The only difference I can think of is the debugger. On the HiLight board I am using the J-Link Lite debugger, on the Relax Lite board I am using the integral debugger.

Could this be the problem?

Kind regards,

Andy
0 Likes