-
Notifications
You must be signed in to change notification settings - Fork 181
Open
Description
I'm compiling a couple of programs for the STM32F072 against a pre-built libmbed-os.a
First, I build libmbed-os.a using:
MBED_OS_DIR=mbed-os mbed compile -t GCC_ARM -m STM32F072VB \
--build mbed-os-build \
--library --source mbed-os --custom-targets Targets \
--profile debug --profile Common/mydebug.json
rm $(find mbed-os-build -name '*.o')Then I compile my program sources and link against libmbed-os.a using this command line:
MBED_OS_DIR=mbed-os mbed compile -t GCC_ARM -m STM32F072VB --build ui-build \
--source UserInterface --source ../CAN_API --source Targets \
--custom-targets Targets \
--source Common --source mbed-os-build \
--profile debug --profile Common/mydebug.json -vHowever, the linker is using the weak HAL_InitTick from
mbed-os/targets/TARGET_STM/TARGET_STM32F0/device/stm32f0xx_hal.c
instead of the necessary override from mbed-os/targets/TARGET_STM/hal_tick_overrides.c
$ arm-none-eabi-nm -A -C mbed-os-build/libmbed-os.a | grep HAL_InitTick
mbed-os-build/libmbed-os.a:stm32f0xx_hal.o:00000000 W HAL_InitTick
mbed-os-build/libmbed-os.a:stm32f0xx_hal_rcc.o: U HAL_InitTick
mbed-os-build/libmbed-os.a:hal_tick_overrides.o:00000000 T HAL_InitTick
$ arm-none-eabi-nm -A -C ui-build/UserInterface.elf | grep HAL_InitTick
ui-build/UserInterface.elf:0800583e W HAL_InitTickIn the ui-build/UserInterface.map file I see:
.text.HAL_InitTick
0x000000000800583e 0x24 mbed-os-build/libmbed-os.a(stm32f0xx_hal.o)
Copying mbed-os/targets/TARGET_STM/hal_tick_overrides.c into my custom_targets directory
and re-building fixes the problem.
But I don't want to have to do this.
UserInterface/mbed_app.json looks like this:
{
"macros": [ "USER_INTERFACE_MCU=1", "NDEBUG=1", "MAX_VARIABLES=30" ],
"target_overrides": {
"*": {
"drivers.spi_count_max": 0,
"events.shared-highprio-stacksize": 0,
"events.shared-stacksize": 1024,
"events.shared-dispatch-from-application": true,
"platform.crash-capture-enabled": true,
"platform.error-filename-capture-enabled": false,
"platform.memory-tracing-enabled": false,
"platform.minimal-printf-enable-64-bit": false,
"platform.stack-stats-enabled": false,
"platform.stdio-buffered-serial": false,
"platform.stdio-flush-at-exit": false,
"platform.use-mpu": false,
"rtos.idle-thread-stack-size": 512,
"rtos.main-thread-stack-size": 1024,
"rtos.thread-stack-size": 1024,
"rtos.timer-thread-stack-size": 768,
"target.boot-stack-size": "0x400",
"target.console-uart": false,
"target.console-uart-flow-control": false
}
}
}Common/mydebug.json looks like this:
{
"GCC_ARM": {
"common": [
"-ICommon/include",
"-ITargets/targets/TARGET_STM/TARGET_STM32F0/TARGET_STM32F072VB",
"-I../CAN_API",
"-I../CAN_API/MessageHandling/include",
"-I../CAN_API/MessageHandling/include/mbed" ],
"c": ["-std=gnu11"],
"cxx": ["-std=gnu++14", "-fno-rtti", "-fno-exceptions" ]
}
}My Targets/custom_targets.json looks like this:
{
"STM32F072VB": {
"inherits": ["NUCLEO_F072RB"],
"extra_labels_add": ["STM32F072VB"],
"device_name": "STM32F072VB",
"default_lib": "small",
"supported_form_factors": [],
"features": [],
"components": [],
"overrides": {
"clock_source": "USE_PLL_HSE_XTAL"
}
}
}