Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


Incorrect binary size after compilation.

Hi.
Im trying to build example LwIP_HTTP_Server_Socket_RTOS for STM32F756 from HAL library 1.8.0
Im AC6 Im importing existing project and point to directory where HAL library are. Project is loading correct and Im able to build it but size of generated bin if over 390MB. The ELF file is around 2.5MB so it seems to be fine.
I guess that this is something with linker file:

/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = 0x20050000; /* end of RAM */
/* Generate a link error if heap and stack don’t fit into RAM */
_Min_Heap_Size = 0x400; /* required amount of heap */
_Min_Stack_Size = 0x800; /* required amount of stack */

/* Specify the memory areas */
MEMORY
{
FLASH (rx)  : ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw)  : ORIGIN = 0x20000000, LENGTH = 307K
Memory_B1(xrw)  : ORIGIN = 0x20010000, LENGTH = 0x80
Memory_B2(xrw)  : ORIGIN = 0x20010080, LENGTH = 0x80
Memory_B3(xrw)  : ORIGIN = 0x2004C000, LENGTH = 0x17d0
Memory_B4(xrw)  : ORIGIN = 0x2004D7D0, LENGTH = 0x17d0

}

/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH

/* The program code and other data goes into FLASH */
.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 */
} >FLASH

/* Constant data goes into FLASH */
.rodata :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >FLASH

.ARM.extab  : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH

.preinit_array  :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >FLASH
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >FLASH
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} >FLASH

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

/* Initialized data sections goes into RAM, load LMA copy after code */
.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> FLASH


/* Uninitialized data section */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
bss_start = _sbss;
*(.bss)
*(.bss*)
*(COMMON)

. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
bss_end = _ebss;
} >RAM

/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >RAM



/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}

.ARM.attributes 0 : { *(.ARM.attributes) }
.RxDecripSection : { *(.DMARxDscrTab_section) } >Memory_B1
.TxDescripSection : { *(.DMATxDscrTab_section) } >Memory_B2
.RxarraySection : { *(.Rx_Buff_section) } >Memory_B3
.TxarraySection : { *(.Tx_Buff_section) } >Memory_B4
}

I generated hex file for this project and when I open it in STM32 link utility I can see that there are also sections 0x20010000, 0x20010080, 0x2004C000, 0x2004D7D0 filled with 0. How I can gerate binary file of correct size?
Thanks.

Hi, seems like the linker file is ok, and since the .elf is ok so that means that there is no issues with the linker file, so i will recommend you to generate the hex file as follows:
arm-none-eabi-objcopy -O ihex {yourelfname}.elf “{binaryname}.hex”
that command will generate a hex file based on the .elf that is alerady working

Thanks for reply,
I already generate hex and bin files but I need binary file only. Im using bin files in bootloader for update existing application.
If I will delete:
attribute((section(“.RxDecripSection”))) and rest in variables declaration in ethernetif.c
bin file is 105kB but probably it will not work correct.
So Linker seems to also add to bin file variable that got allocated address in RAM. Do I need to change something in startup script?


I will recommend you to do the following before changing the linker file

if the .elf works and you can download and debug I suggest to get the binary from the .elf file (elf and binary may be created with different settings i.e. compiler or linker flags may be different, epecially if you imported the project ), so to get the binary you can do it executing this command :
arm-none-eabi-objcopy -O binary add.elf add.bin

I am sure that that method shuld work because rememeber that the .elf file is the binary file + debug infomation and meta data, so you sould be able to extract only the binary data from a file that you already know that is working.

also you might want to take a look at this post:
https://answers.launchpad.net/gcc-arm-embedded/+question/261132Question


Post-build steps are default:
arm-none-eabi-objcopy -O binary “${BuildArtifactFileBaseName}.elf” “${BuildArtifactFileBaseName}.bin” && arm-none-eabi-size “${BuildArtifactFileName}”

It looks like it is related with variable declarations
ETH_DMADescTypeDef DMARxDscrTabETH_RXBUFNB attribute((section(“.RxDecripSection”)));
I changed it to :
extern ETH_DMADescTypeDef DMARxDscrTabETH_RXBUFNB;
and in linker file I add
DMARxDscrTab = 0x20010000;
and now bin size is correct. When I debug app I can see that array DMARxDscrTab is on the right place (0x20010000).
Im not expert in linker files so not sure if this is correct way to do that.

There is a magic word in linker command file : NOLOAD

look here for more details :

https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_21.htmlQuestion

excerpt
(NOLOAD)
The `(NOLOAD)’ directive will mark a section to not be loaded at run time. The linker will process the section normally, but will mark it so that a program loader will not load it into memory. For example, in the script sample below, the ROM section is addressed at memory location `0’ and does not need to be loaded when the program is run. The contents of the ROM section will appear in the linker output file as usual.

SECTIONS {
ROM 0 (NOLOAD)  : { ... }
...
}

Hi i have the same problem

where in the file ld you put DMARxDscrTab = 0x20010000;


I do not knwo if that is the best way to do it but I can tell you what your current linker is trying to do with the buffer ETH_DMADescTypeDef DMARxDscrTabETH_RXBUFNB

That buffer need to be in a fix memory location so in the linker file they created a memory sector Memory_B1(xrw)  : ORIGIN = 0x20010000, LENGTH = 0x80 , then almost at the end onf the linker they assing the section .RxDecripSection to sector Memory_B1 and since the previous declaration sets the buffer to the section .RxDecripSection then the buffer is set to address 0x20010000.

basically you are doing the same