STM32H7 - ExtMem_Boot: hardfault caused by unaligned memory access

0

I'm playing with the STM32h7B3I-DK with the ExtMem_Boot and the LedToggling application. I'm trying to load bootload the both DATA and CODE in the internal ram as follows:

#define DATA_AREA USE_INTERNAL_SRAM // //
#define CODE_AREA USE_INTERNAL_SRAM // USE_EXTERNAL_SDRAM //
#define BINARY_AREA USE_SPI_NOR // USE_SDMMC //

But after flashing both the boot and app binaries, the extboot application rise an hardfault caused by unaligned memory access when accesing the OSPI. While if I return in the original configuration with #define CODE_AREA USE_EXTERNAL_SDRAM, everythings goes fine.

I do not know if it is caused by and error in the bootloader app or in the linking of the LedToggling app, heres how I updated the ld file of the LedToggling:

    MEMORY
{
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 1000K
ROM (rx) : ORIGIN = 0xD0000000, LENGTH = 8192K
}

/* Sections /
SECTIONS
{
/ The startup code into "ROM" Rom type memory /
.isr_vector :
{
. = ALIGN(4);
KEEP((.isr_vector)) /* Startup code */
. = ALIGN(4);
} >RAM /ROM/

/* The program code and other data into "ROM" Rom type memory /
.text :
{
. = ALIGN(4);
(.text) / .text sections (code) /
(.text) / .text sections (code) */
(.glue_7) / glue arm to thumb code */
(.glue_7t) / glue thumb to arm code */
*(.eh_frame)

KEEP (*(.init))
KEEP (*(.fini))

. = ALIGN(4);
_etext = .;        /* define a global symbols at end of code */
} >RAM /ROM/

/* Constant data into "ROM" Rom type memory /
.rodata :
{
. = ALIGN(4);
(.rodata) / .rodata sections (constants, strings, etc.) /
(.rodata) / .rodata sections (constants, strings, etc.) */
. = ALIGN(4);
} >RAM /ROM/

.ARM.extab : {
. = ALIGN(4);
(.ARM.extab .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >RAM /ROM/

.ARM : {
. = ALIGN(4);
__exidx_start = .;
(.ARM.exidx)
__exidx_end = .;
. = ALIGN(4);
} >RAM /ROM/

.preinit_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP ((.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
} >RAM /ROM/

.init_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP ((SORT(.init_array.)))
KEEP ((.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
} >RAM /ROM/

.fini_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP ((SORT(.fini_array.)))
KEEP ((.fini_array))
PROVIDE_HIDDEN (__fini_array_end = .);
. = ALIGN(4);
} >RAM /ROM/

/* Used by the startup to initialize data */
_sidata = LOADADDR(.data);

/* Initialized data sections into "RAM" Ram type memory /
.data :
{
. = ALIGN(4);
_sdata = .; / create a global symbol at data start /
(.data) / .data sections /
(.data) / .data sections */

. = ALIGN(4);
_edata = .;        /* define a global symbol at data end */
} >RAM /AT> ROM/
stm32
ram
bootloader
asked on Stack Overflow Jul 6, 2020 by Paul Lake • edited Jul 7, 2020 by Mayur Dhingra

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0