STM32F072: Linking in SES and Atollic IDE

STM32F072CB, Mainstream ARM Cortex-M0 USB line MCU with 128 Kbytes Flash, 48 MHz CPU, USB, CAN and CEC functions

Specs

HOWTO Use the GCC specs file
How to set gcc 4.3 default specs file?
Frequently Asked Questions

Studio

Using External GCC
Building with a SEGGER Embedded Studio project file

Wiki

How to use an external toolchain with Embedded Studio

Website

Tool chain and Compiler
Project Management
Performance
SEGGER Linker

Blog

The SEGGER Linker – Replacing the GNU linker
Killer features of the SEGGER linker, or what’s wrong with the GNU linker?

A C Library for embedded applications

Most GCC based projects use Newlib or its smaller version Newlib nano as the standard C Library. Newlib has been created for full-featured computers with lots of memory. Even Newlib nano might require a lot of stack and even heap for functions, such as printf.

Embedded Studio comes with its own standard C Library. The library has been created from scratch, tailored and optimized for embedded applications, to be used on even the smallest micros.

cd C:\msys64\home\bachman0\Fluoedema\Firmware
"C:\Program Files\SEGGER\SEGGER Embedded Studio for ARM 4.12\bin\emBuild.exe" -echo -config "Debug" Fluoedema.emProject
"C:\Program Files\SEGGER\SEGGER Embedded Studio for ARM 4.12\bin\emBuild.exe" -echo -clean -config "Debug" Fluoedema.emProject
4>C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 4.12/gcc/arm-none-eabi/bin/cc1
-fmessage-length=0
-fno-diagnostics-show-caret
-mcpu=cortex-m0
-mlittle-endian
-mfloat-abi=soft
-mthumb
-mtp=soft
-mno-unaligned-access
-nostdinc
-isystemC:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 4.12/include
-isystemC:/Users/bachman0/AppData/Local/SEGGER/SEGGER Embedded Studio/v3/packages/include
-IC:/msys64/home/bachman0/Fluoedema/Firmware/src
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc/chibi/board
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc/chibi/hal
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc/chibi/osal
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc/chibi/platform
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc/chibi/startup/CMSIS
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc/chibi/startup/ST
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc/chibi/startup
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc/chibi/various
-IC:/msys64/home/bachman0/Fluoedema/Firmware/inc/chibi/lib
-D__SIZEOF_WCHAR_T=4
-D__ARM_ARCH_6M__
-D__SES_ARM
-D__SES_VERSION=41200
-DDEBUG -DCRT1_AREAS_NUMBER=1
-DSTM32F072B_DISCO
-DSTM32F072RBTx
-DSTM32F0
-DSTM32
-DDEBUG
-DHAL_USE_USB=TRUE
-DHAL_USE_SPI=TRUE
-DHAL_USE_SERIAL=TRUE
-DHAL_USE_ADC=TRUE
-DHAL_USE_UART=FALSE
-DHAL_USE_GPT=TRUE
-DSTM32_GPT_USE_TIM14=TRUE
-DHAL_USE_WDG=TRUE
-DSTM32_WDG_USE_IWDG=TRUE
-MD C:/msys64/home/bachman0/Fluoedema/Firmware/Debug/sen.d
-MQ Debug/sen.o
-quiet
-std=gnu99
-g3
-gpubnames
-Og
-fomit-frame-pointer
-fno-dwarf2-cfi-asm
-fno-builtin
-ffunction-sections
-fdata-sections
-fshort-enums
-fno-common
C:\msys64\home\bachman0\Fluoedema\Firmware\src\sen.c
-o C:/msys64/home/bachman0/Fluoedema/Firmware/Debug/sen.asm

4>C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 4.12/gcc/arm-none-eabi/bin/as
--traditional-format
-mcpu=cortex-m0
-mlittle-endian
-mfloat-abi=soft
-mthumb
C:/msys64/home/bachman0/Fluoedema/Firmware/Debug/sen.asm
-o Debug/sen.o
undefined reference to __aeabi_read_tp
C:\msys64\home\bachman0\Fluoedema\Firmware>
"C:\Program Files\SEGGER\SEGGER Embedded Studio for ARM 4.12\bin\emBuild.exe" -echo -config "Debug" Fluoedema.emProject

1>C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 4.12/gcc/arm-none-eabi/bin/ld
-X
--omagic
-eReset_Handler
--defsym=__vfprintf=__vfprintf_int_nwp
--defsym=__vfscanf=__vfscanf_int
-EL
--gc-sections
-TC:/msys64/home/bachman0/Fluoedema/Firmware/LinkerScript.ld
-Map Output/Debug/Exe/Firmware.map
--defsym=__main_stack_size__=0x600
--defsym=__process_stack_size__=0x000
-u_vectors
-o Output/Debug/Exe/Firmware.elf
--emit-relocs
--start-group
@C:/msys64/home/bachman0/Fluoedema/Firmware/Output/Firmware Debug/Obj/Firmware.ind
--end-group

C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 4.12/lib/libc_v6m_t_le_eabi.a(libc2.o):
In function `__aeabi_errno_addr':
libc2.c:(.text.libc.__aeabi_errno_addr+0x2): undefined reference to `__aeabi_read_tp'
There were 1 build errors

cc1

Relationship between cc1 and gcc?
GNU C Compiler Internals/GNU C Compiler Architecture

cc1 -o test.s test.c
from C to ASM!

EABI

github.com/m-labs/uclibc-lm32/blob/master/libc/sysdeps/linux/arm/aeabi_errno_addr.c

_AEABI_PORTABILITY_LEVEL=1

How to use errno in multithread environment?
__aeabi_errno_addr()
caddr_t

syscalls

syscalls.c compilation errors
IMPLEMENTING SYSCALLS FOR LIBC
How to include syscalls.c from a separate library file?

newlib

Getting NewLib and printf to work with the STM32 and Code Sourcery Lite eabi
Using Newlib in ARM bare metal programs
Issue with compling ARM assembly code

arm-none-eabi-as p1.s -o p1.o
arm-none-eabi-gcc -specs=rdimon.specs p1.o -o p1
arm-none-eabi-gcc: error: rdimon.specs: No such file or directory

Linking issues

  GROUP (
"libcr_semihost_nf.a"
"libcr_c.a"
"libcr_eabihelpers.a"
)

-specs=rdimon.specs

Link problem with rdimon.specs
Linker error on a C project using Eclipse

Semihosting

What is semihosting?
What is semihosting?
What is Semihosting?
Semihosting für ARM verwenden

Specs to Linker?

How to pass specs to gcc linker?

ld or gcc

gcc -Wl,linker-option
Options for Linking

ARM Simulator

(gdb) target sim
Undefined target command: "sim".  Try "help target".

./configure --enable-sim

arm-none-eabi-gdb: Undefined target command: “sim”
Guide to using GDB in simulation mode
Does arm-none-eabi-gdb support simulator

Leave a Reply

Your email address will not be published. Required fields are marked *