110 questions
2
votes
1
answer
94
views
Error: expected string literal before '__asm' in a pico-sdk project?
In my RP2040 pico-sdk project, I'm getting a problem when I try to use the CMSIS function __DSB() - "error: expected string literal":
/src/MyProject/my_main.c:848:5: error: expected string ...
1
vote
1
answer
120
views
How can I build a CMake embedded project from CLion without CLion?
Problem
I can't build my embedded C project without using CLion. CMake gives me errors when trying to build my project through a podman machine (Fedora Linux 42). It fails with two potential problems
...
3
votes
1
answer
208
views
Using gcov on STM32
I'm trying to use GCOV for code coverage on my stm32F439ZI.
I just have a quick LED example set up, no OS, no filesystem. My goal, i think, is to edit the write function that gcov use to write the ...
0
votes
0
answers
41
views
Why does calling CORDIC on an STM32H723 slow down my main loop (e.g., LED blinking) even though it’s called only once?
I am trying to enable the potential of CORDIC engine on the STM32H723ZGT6 MCU. I implemented how its guided in the reference manual. I get the values after CORDIC is done computing but, the LED toggle ...
1
vote
1
answer
100
views
When the bitfield is written in the for loop, the behavior of -fstrict-volatile-bitfields is incorrect and the strb instruction is generated
Compiler:
arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi
I use bitfields to write peripheral registers, and can only write 32-bit, so cannot use strb. I used the gcc -fstrict-volatile-...
0
votes
0
answers
125
views
Embedded GCC vs IAR debugging experience & binary size
I have an embedded GCC application compiling with the -Os flag, however step-by-step GDB debugging is borderline unusable due to the aggressive optimizations to reduce code size (debugger jumps around,...
2
votes
0
answers
51
views
Do I need to rebuild newlib-nano with -fPIE to reliably build a position-independent executable on ARM Cortex-M?
I'm developing a monolithic, standalone position-independent executable (PIE)
for an ARM Cortex-M microcontroller. The executable doesn't call any external
functions, nor is it called by any external ...
0
votes
0
answers
121
views
STM32CubeMX generated Makefile - Abnormal Behaviour
I am having a problem with STM32CubeMX on linux. I used CubeMX to create a new project, setup peripherals and generated a makefile (the code is a timer example from ST github page). Inside the ...
4
votes
0
answers
145
views
Why is a volatile symbol placed differently?
When an array is declared with volatile it ends up somewhere different than without:
static const char ARRAY[100];
$ nm a.elf | grep ARRAY
00010d00 t ARRAY
But:
static volatile const char ARRAY[100];...
0
votes
0
answers
74
views
Errors attempting to compile using make and Arm-none-eabi-gcc
I have been learning how to work with toolchains and makefiles directly and compile for a teensy 4.1 microcontroller. Ive been basing my code off of the teensy-duino core makefile. My makefile so far ...
2
votes
0
answers
201
views
Reading symbols in arm-none-eabi-gdb takes a very long time
I have been facing some issues with arm-none-eabi-gdb taking a very long time (~40s) to read symbols from a small ELF-file. I only see this on one computer, on all other I have tested, it takes just a ...
3
votes
0
answers
93
views
c++ exception failed in arm-none-eabi-g++
I want to use c++'s exception with arm-none-eabi-g++9.2.1 on Cortex-A9 board.
But I found that, exception could be caught but "terminate" will also be called.
To use C++ exception,
I've ...
0
votes
0
answers
208
views
In arm-none-eabi-gdb how the cortex-M peripherals can be accessed using .SVD file?
I am trying to make a baremetal project using cortex-M0 processor in ubuntu. In the layout window the registers are visible but for the mcu peripherals .SVD file needs to read and displayed.
I tried ...
1
vote
0
answers
107
views
Cross-Compiling libjpeg-turbo for RPi Pico (RP2040)
I'm trying to cross-compile libjpeg for RPi Pico, I'm using arm-none-eabi-gcc for this purpose. This is the command that I used to compile it:
cmake -DCMAKE_TOOLCHAIN_FILE=C:/pico-sdk/cmake/preload/...
0
votes
1
answer
48
views
Is the libsnark library compatible with the arm-none-eabi toolchain for ARM Cortex-M microcontrollers?
I am currently working on a project that involves implementing cryptographic protocols on ARM Cortex-M microcontrollers, specifically the Raspberry Pi Pico (RP2040). I am interested in using the ...
0
votes
1
answer
165
views
Is there a way to add Local Symbol names in the ELF file by adding debug flags to the arm-none-eabi-gcc compiler?
I am able to view the global symbols such as functions, global/static variables in the final built executable in elf file. I am looking for compilation flags that can add the local variable names into ...
0
votes
1
answer
298
views
Running firmware on qemu error - fatal: Lockup: can't escalate 3 to HardFault (current priority -1)
I am trying to compile some c programs and run them on qemu on a 'lm3s6965evb' machine. More specifically, I am compiling c programs from WCET benchmark suite with the following commands:
arm-none-...
0
votes
0
answers
112
views
Quirk with objdump on binary files compiled on a different operating system
I have found some odd behavior when using objdump. For an example to describe this issue, consider the simple c file:
#include <stdio.h>
int main()
{
return 0;
}
If I then compile using the ...
0
votes
1
answer
309
views
Using ccache with '-specs=nano.specs'
I'm trying to cross-compile with arm-none-eabi-gcc, which needs the flag -specs=nano.specs.
Unfortunately that seems to break ccache. In the logs I now have:
[2024-01-24T10:36:58.306578 191738] Failed ...
0
votes
3
answers
1k
views
How does arm-none-eabi-gcc 9.2 implement malloc/free?
I am seeking the implementation details of malloc() and free() in the arm-none-eabi-gcc source code. I have observed that malloc()/free() functions work on STM32 without an operating system and any ...
0
votes
0
answers
1k
views
Please explain how to install old version of arm-none-eabi-gcc
I want to compile specific embedded project, and with newest version of arm cross compiler installed from repository it doesn't work. So author is recommend to use previous version (10.3.1) instead ...
0
votes
0
answers
144
views
Fix HardFault on stm32h7 with arm native toolchain, with CubeIDE it works fine
I have the following function that serializes the RTC data of the microcontroller:
string serialize() const {
return "\"counter\": " + to_string(counter);
}
Besides the clear ...
2
votes
0
answers
279
views
Baremetal Cortex-M7 gcc and unwind tables without libunwind
I'm working on a project using an STM32H743 MCU which has a Cortex-M7. I'm building outside of ST's toolchain and IDE with gcc-arm-none-eabi (13.2 Rel 1). My project is written entirely in C and ...
0
votes
0
answers
720
views
Using CMake, make and arm-none-eabi-gcc in Windows
I'm part of a team that develops applications targeting ARM microcontrollers, the target is as you could guess by the post title bare-metal, we have been using STM32CubeIDE, which builds projects both ...
1
vote
1
answer
472
views
Came up with an "Unable to stat debugging" error when Debug program for STM32 NUCLEOF103RB
I am trying to use STM32 VSC extension plugin on VSCode for a better coding experience, but error occored when I am trying to debugging.
VSCode suggested that build task finish successfully in the ...
0
votes
1
answer
741
views
arm-none-eabi-gcc undefined reference to math.h and complex.h functions
I'm trying to use complex.h and math.h in my embedded stm32f4 microcontroller code. Considering below sample code:
#include <math.h>
#include <complex.h>
#define PI 3.141593f
void ...
0
votes
0
answers
784
views
configure: error: cannot compute suffix of object files: cannot compile
I am trying to compile a compiler for ARM targets using as base following link:
https://gitlab.archlinux.org/archlinux/packaging/packages/arm-none-eabi-gcc/-/blob/main/PKGBUILD?ref_type=heads
I have ...
1
vote
1
answer
1k
views
error: unrecognized command-line option '-rdynamic'
When I generate my build for cross compilation for arm-none-eabi with cmake I have this error:
... is not able to compile a simple test program
...error: unrecognized command-line option '-rdynamic'
...
0
votes
0
answers
95
views
What is the purpose of the gcc ARM-option -mlibarch?
I took over a project started from a colleague of mine and now I'm trying to understand what he did so far.
Aim of the project is run a Profinet device on a NetX90 (2x Cortex M4).
The IDE used so for ...
1
vote
1
answer
1k
views
arm-none-eabi-gdb python fatal error (Ubuntu 22.04)
in my Ubuntu 22.04, I wanted to open a GDB client to connect to openocd. So I used arm-none-eabi-gdb, however I received the following error
Could not find platform independent libraries <prefix>...
0
votes
1
answer
222
views
arm-none-eabi-gcc: packed attribute causes inefficient alignment
When adding the -Wpacked option to arm-none-eabi-gcc combiler it issues the following warning:
warning: packed attribute causes inefficient alignment for 'struct field name'
For example,
struct ...
0
votes
0
answers
232
views
Bare-Metal : During Makefile I receive this error "..../arm-none-eabi/bin/ld: error: .: read: Is a directory"
I am using Ubuntu 22.04 to do some bare metal programming.
I have 3 files to compile and link to create a .elf file name app.elf (im using Makefile to do this).
However I encountered the error below:
$...
0
votes
2
answers
1k
views
CMake - Dynamically determine CPU Architecture
I am working on a CMake build script that requires the ARM embedded toolchain. Depending on the user's OS and CPU architecture, a different version of the toolkit needs to be downloaded. This is fine ...
0
votes
0
answers
61
views
Reduce command size given to gcc in windows
I am trying to build free RTOS application. My application has may submodules and the paths are getting very long. I have updated the windows path limit. but the problem is that the command to give to ...
0
votes
0
answers
136
views
Writing volatile variable optimized by compiler
I am using C++ with the arm-none-eabi-gcc compiler and I am wondering why the new compiler version (10.3.1) decides to optimize out a function call which modifies a volatile variable while the old ...
1
vote
1
answer
507
views
What flags are needed in arm-none-eabi-gcc to produce FDPIC ELF binary?
what flags do i need to add to:
arm-none-eabi-gcc test.c -o test -mcpu=cortex-m4 -Wall -Os
to get FDPIC binary ?
I made many experiments, and still i receive not a valid format. I know about ...
0
votes
1
answer
1k
views
Linking issue with arm-none-eabi-gcc compiler - warning: cannot find entry symbol _vectors; defaulting to 0000000010260000
I am trying to do a very simple exercise as shown below
Compiler a simple C program using arm-none-eabi-gcc compiler for a Cortex-R5 MCU target.
Link it with the respective linker file and create a ...
0
votes
1
answer
805
views
How can I generate elf file with debug info using arm-none-eabi-ld?
I'm trying to remote debug compiled code for arm on qemu. But I cannot set breakpoints based on symbols.
Below is my mk script:
ARM=arm-none-eabi
QEMU=qemu-system-arm
$ARM-as -o ts.o ts.s -g
$ARM-ld -...
0
votes
1
answer
259
views
Undefined reference to `posix_memalign' in arm-none-eabi
I am trying to build liboqs (https://github.com/open-quantum-safe/liboqs) on Ubuntu to use as a library on STM32L432. I successfully ran cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_armel....
2
votes
1
answer
4k
views
clangd doesn't find <stdio.h> and finds the wrong <stdint.h> when using arm-none-eabi-gcc
I'm using VS Code with the clangd plugin and it can't find <stdio.h>. Clangd is able to parse all of the source files in my project without any problem. But certain header files are not found ...
0
votes
1
answer
435
views
How to set a value at specified address in an elf file
I have a project for a cortex M4 microcontroller, which compiles and runs fine.
I'd like to add the checksum of the file to the file itself, so I can check the correctness of the binary at runtime.
...
0
votes
0
answers
686
views
Why is a static const "variable" not seen as constant for static assert [duplicate]
In a software for a STM32 arm microcontroller I have a bunch of constant parameters that should be configured before compilation. These are defined as static const integers and not as #defines to ...
0
votes
0
answers
56
views
why no error message when alias function with different prototype?
test.c
void __f () { /* Do something. */; }
int f (int) __attribute__ ((weak, alias ("__f")));
test.h
void f ();
main.c
//call f
f();
the __f() and alias f() has different prototype.
use ...
6
votes
0
answers
5k
views
arm-none-eabi-gcc "is not implemented and will always fail" messages
I have two stm32 projects (one with stm32f103rb and the other with stm32f103re). Both projects are built using cmake and make based on stm32-cmake template and also use cubeMX HAL libraries. For both ...
0
votes
1
answer
785
views
argument unused during compilation: '-mcpu=cortex-m7' when using arm-none-eabi-g++ with clang-tidy
I am using CMake to run clang-tidy while compiling my embedded target.
if(CLANG_TIDY)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy")
endif()
CMake sets the correct driver mode automatically:
--...
0
votes
1
answer
58
views
Eclipse truncates my compiler problem descriptions
For a while now, my Eclipse makefile project has been truncating all compiler problem descriptions, both in the code space and in the "Problems" window.
Examples in images below - does ...
2
votes
1
answer
518
views
Possible to implement MMU functionality in software with GCC?
I have an ARM Cortex-M0+ MCU (SAML21) that doesn't have a memory management unit or external memory interface, but I would like to use an existing library (libavif + libaom) to manipulate data that ...
1
vote
1
answer
386
views
GCC __builtin_expect checking pointer nullability of temporary during constexpr context results in strange run time behavior
I'm using __builtin_expect to perform a null pointer check in a constexpr function like so:
constexpr int Add(const int * x, const int * y)
{
assert(__builtin_expect(!!(x && y), 1));
...
1
vote
1
answer
171
views
What binary elf output format allows me to add a .sram section in my binary when linking?
I am trying to compile an application using arm-none-eabi-gcc and would like specific section names to be contained in my binary. The binary is usually compiled by my IDE.
From the official GNU ...
3
votes
0
answers
2k
views
Why error: no memory region specified for loadable section `.bss'?
I am trying to build an application manually using arm-none-eabi-gcc. The build goes fine but I get the following error during link time:
error: no memory region specified for loadable section `.bss'
...