I've recently run into this error where openocd wont flash the binary to my discovery board. I'm using the same linker script that i've been using all along.
arm-none-eabi-objdump gives the following output:
src/stm32_uavcan/stm32test: file format elf32-littlearm
Disassembly of section .init:
00008000 <_init>:
8000: b5f8 push {r3, r4, r5, r6, r7, lr}
8002: bf00 nop
8004: bcf8 pop {r3, r4, r5, r6, r7}
8006: bc08 pop {r3}
8008: 469e mov lr, r3
800a: 4770 bx lr
Disassembly of section .text:
00008040 <exit>:
8040: b508 push {r3, lr}
8042: 2100 movs r1, #0
8044: 4604 mov r4, r0
8046: f002 fe91 bl ad6c <__call_exitprocs>
804a: 4b04 ldr r3, [pc, #16] ; (805c <exit+0x1c>)
804c: 6818 ldr r0, [r3, #0]
804e: 6bc3 ldr r3, [r0, #60] ; 0x3c
8050: b103 cbz r3, 8054 <exit+0x14>
8052: 4798 blx r3
8054: 4620 mov r0, r4
8056: f000 ff03 bl 8e60 <_exit>
805a: bf00 nop
805c: 0000eec8 .word 0x0000eec8
The flash addresses are completely off.
From what i know this is the correct address "0x08000000". And is defined as such in my linker script. Below is the copy of the relevant part of the linker script
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
MEMORY_ARRAY (xrw) : ORIGIN = 0x20002000, LENGTH = 32
}
I'm using CMake. The project uses other third-party libraries as well, uavcan, chibios and stm32plus. I dont think that should be an issue. Below is the CMakeLists for this project.
cmake_minimum_required(VERSION 3.2)
project(stm32_uavcan)
list(APPEND CMAKE_PREFIX_PATH /usr/local/arm-none-eabi /usr/arm-none-eabi CACHE STRING "Library Search Paths")
set(MCU_FAMILY f429)
if((CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
set(STM32PLUS_CONFIGURATION fast-${MCU_FAMILY}-8000000)
endif((CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
if((CMAKE_BUILD_TYPE MATCHES MinSizeRelease))
set(STM32PLUS_CONFIGURATION small-${MCU_FAMILY}-8000000)
endif((CMAKE_BUILD_TYPE MATCHES MinSizeRelease))
if((CMAKE_BUILD_TYPE MATCHES Debug))
set(STM32PLUS_CONFIGURATION debug-${MCU_FAMILY}-8000000)
endif((CMAKE_BUILD_TYPE MATCHES Debug))
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
find_package(stm32plus REQUIRED)
add_executable(stm32test
src/AX2550.cpp
src/main.cpp
src/LibraryHacks.cpp
src/ringbuf.c
src/system_stm32f4xx.c
)
target_sources(stm32test
PRIVATE
${CHIBIOS_SOURCES}
)
target_include_directories(stm32test
PUBLIC
include
${PROJECT_CONF_DIR}
${CHIBIOS_INCLUDE_DIRS}
${STM32PLUS_INCLUDE_DIRS}
${STM32PLUS_FWLIB_DIR}
${STM32PLUS_DEVINC})
target_link_libraries(stm32test ${STM32PLUS_LIBS})
set_target_properties(stm32test PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
I dont know how to solve this. Any advice or suggestions could really help me out.
Regards.