Questions tagged [gcc]

The GNU Compiler Collection (GCC) is a collection of open source compilers. Originally it only supported the C programming language but now also supports C++, Objective-C, Java and several other languages. The C and C++ compilers are popular for embedded development and support cross-compiling to many popular target processors.

Filter by
Sorted by
Tagged with
22
votes
7answers
32k views

For embedded code, why should I use “uint_t” types instead of “unsigned int”?

I am writing an application in c for an STM32F105, using gcc. In the past (with simpler projects), I have always defined variables as char, ...
18
votes
5answers
17k views

Is Code Sourcery G++ Lite still a viable project?

When I tried to download a newer version of Code Sourcery G++ Lite for ARM, I noticed that I was redirected to another company and it is really hard to find anything on that site about Sourcery G++ ...
16
votes
2answers
17k views

STM32F2: Makefile, linker script and start-up file combination without commercial IDE

I have been working with an STM32F2 (specifically, the STM32F217IGH6 on a development board) for about two months. By far my biggest problem had to do with the "setup", which includes makefile, linker ...
11
votes
4answers
15k views

Endian problem on STM32

I'm using arm gcc (CooCox) to program an STM32F4discovery, and I've been wrestling w/ an endian problem I'm sampling with a 24 bit ADC via SPI. Since three bytes are coming in, MSB first I had the ...
10
votes
3answers
5k views

Eclipse + GNU ARM + STM32 - HAL or SPL

I am going to start with ARM development (after 2 years of AVRs) and have picked up the STM DISCOVERY board with the stm32f4 microprocessor on it. I have decided to go with eclipse + ARM gcc since I ...
9
votes
4answers
2k views

Why GCC compiler omitting some code?

I can not understand why GCC compiler cutting out part of my code while it preserve absolutely the same one in the neighborhood? The C code: ...
8
votes
2answers
9k views

Move embedded programming from Keil to Linux

I'm currently using Keil to develop for an STM32 discovery board. My project is close to finished, and I'd like to move to a Linux based building environment. I've been using the preconfigured ...
7
votes
4answers
3k views

Embedded C - Most elegant way to insert a delay

I'm working on a project involving a cortex-m4 mcu (LPC4370). And I need to insert a delay while turning on compiler's optimization. So far my workaround was to move up and down a digital output ...
6
votes
1answer
301 views

Why is the AVR GCC compiler using a full `CALL` even though I have set the `-mshort-calls` flag?

I have set the -mshort-calls flag which is documented to replace the 4 byte long CALL instruction with the 2 byte long ...
6
votes
1answer
1k views

What is relation between ARM libraries

What is relation between CMSIS libs released by ARM.com, libraries provided by manufacture and GCC ARM libraries ? What is the exact purpose of each? Which of them Should I use?
6
votes
3answers
384 views

Digital signal controller with GNU toolchain?

Does any manufacturer offer a digital signal controller (which basically means a microcontroller with some DSP functionality like a MAC instruction and other stuff) to which I could compile software ...
5
votes
1answer
2k views

ARM startup file attributes vs GCC command line arguments

The startup files for STM32 Cortex-M MCU's, for most GCC toolchains, often bundle the Atollic TrueStudio startup assembly files with HAL libraries, like for example in my case, STM32CubeF4. I'm ...
4
votes
2answers
689 views

Lightweight (subset) of standard C library (ANSI C library)

I'm porting standard C library for bare metal "OS" (ARM Cortex-M4, ARM GCC). I want to have functions like strlen, sprintf, (and memory allocator, maybe), etc. I've ported PDCLib and Newlib. Newlib ...
4
votes
2answers
5k views

atmel studio for mac

Is Atmel Studio compatible with Mac or Linux? It seems like there is only Windows support from the downlaods here: http://www.microchip.com/mplab/avr-support/atmel-studio-7.
4
votes
1answer
382 views

Microcontroler with external bus

I am looking for some microcontroler with external bus for program memory, and witch is supported by GCC. I read this Atmel ATSam3U datasheet (I have no experience with this familly, yet) and there ...
4
votes
1answer
3k views

Unable to compile STM32F4 code sample with Eclipse

I'm trying to compile a simple STM32F4 sample using Eclipse with the GNU ARM Eclipse plugin from http://gnuarmeclipse.livius.net/blog/. I'm getting the following errors: and the structure is as ...
4
votes
1answer
493 views

How does gnu linker obtain Cortex-M stack pointer value?

GNU's linker obtains the ARM Cortex's stack pointer value from the linker script, and places that value in the first location of the interrupt vector table. I note that most of my scripts use the ...
3
votes
1answer
179 views

AVR bit manipulation compilation in GCC: can not get SEI instead of read-modify-write

I'm trying to set bit 2 in TIMSK register and using the following C code: TIMSK |= (1<<2); Compiler makes the following code: ...
3
votes
2answers
1k views

What is STM8 hardware and software interrupt latency?

Just have a first look over the STM8 lineup to compare its performance to AVR which is well know for me now. One of my the big complain to AVR was the slow reaction to interrupts especially in C ...
2
votes
4answers
4k views

Can I use just plain GCC to compile program for Nucleo?

I have a ST Nucleo F446RE. It's an ARM board which provides quite an interesting interface for uploading programs - it presents itself as USB storage device and the program can be copied on it, which ...
2
votes
3answers
5k views

Sublime Text editor to develop ARM-based software

Until this moment I used Atmel Studio to develop software for AVR-based devices. Now I'd like to go to ARM Cortext M. Additionally I'd like to try codesign and version control (I still not experienced ...
2
votes
1answer
302 views

Avr-gcc does not compile correctly without optimizations, but works (badly) with -Os

I am developing software for attiny88 with avr-gcc toolchain. This is a cheap microcontroller with 8kB program memory, 512B SRAM and 64B non-volatile EEPROM data memory. This is all sufficient for the ...
2
votes
1answer
385 views

Compiling MSP430 files linking problems

I'm trying to compile a simple C file to later upload to my MSP430 uC but when I try to compile I get something that looks like a linking problem: ...
2
votes
2answers
571 views

Accessing stm32 registers via structs in GCC

I'm trying to roll my own USB device using an STM32F103 blue pill board in C with the GCC arm-none-eabi compiler, but I've run into some strange behavior that I'm trying to understand. I've created ...
2
votes
4answers
805 views

AVR GCC: How do I improve code optimization

I tried to compile the following C code: period = TCNT0L; period |= ((unsigned int)TCNT0H<<8); The assembler code I'm getting is the following: ...
2
votes
2answers
826 views

Talking to the Cortex M3 (Stellaris EKS-LM3S1968) under linux

I've searched around quite a lot, but haven't found an easy(ish) way to load programs onto the Cortex M3 using Linux. I have tried using the summon-arm-toolchain https://github.com/esden/summon-arm-...
2
votes
2answers
208 views

How does avr-gcc linker know to put the `.data`section at `0x800100` rather than `0x800060`?

Looking at the linker script for my part (ATMEGA168PD), the data region has an origin defined as starting at 0x800060... ...
2
votes
2answers
1k views

STM32 NaN value for floating point operations on global variables

I am trying to implement a simple Odometry computation loop. Which is being run in a while loop. Following is the code: ...
2
votes
0answers
442 views

Atmel Studio: redefine weak function

I want to write my own implementation of SERCOM3_Handler. I put its definition in my main.c, try to compile it and get "multiple definition of SERCOM3_Handler" error. Why is this happening? The ...
1
vote
1answer
956 views

STM32L0 Snippets with GCC ARM Toolchain

Currently I try to use the STM32L0 microcontroller series. I found that ST offers a low-level C program collection called STM32SnippetsL0 too, parallel with their complex STM32CubeMX based HAL API. ...
1
vote
2answers
5k views

AVR GCC : Global / Static Array not getting initialized properly

Im having problem with global arrays in my C code. What i am trying to do is to use a display buffer (array of 8 uint8_t with each uint8_t representing a row) to light up the leds in 8x8 led matrix ...
1
vote
1answer
172 views

ESP8266 and GCC

I think this is more related to GCC rather than ESP8266. I have been trying to put in a constant variable in read only memory section of ESP. The idea is to change the value directly in the binary ...
1
vote
1answer
105 views

MSP430G2553 WDT ISR compilation error - GNU v4.9.1

I'm using GNU v4.9.1 compiler, and I'm just trying to work with WDT timer: void __attribute__((interrupt(WDT_VECTOR))) WDT_ISR(void) { P2OUT ^= BIT1; } When ...
1
vote
0answers
88 views

How to create address independent code for STM32F746?

I need to create an address independent, dynamically reallocable code for STM32F746: a code (program) that I will store in one place (i.e. external Flash), than load it into the RAM (internal or ...
1
vote
0answers
3k views

What shall be changed about stm32f4x7_eth_bsp.c

I am using STM32f407ZGT6. FreeRTOS is running perfectly on Board! I have included Ethernet files. According compilation of Windows Commander stating that it was compiled lacked free. But if one ...
0
votes
1answer
97 views

Difference between `gcc` and `gcc-msp430`

What is the difference between using gcc versus using gcc-msp430? When I run man gcc, there ...
0
votes
2answers
8k views

STM32 crashing to Default_Handler

My STM32F4 Discovery is crashing when I try to run the sin or sinf function with the FPU enabled and with the FPU disabled. ...
0
votes
1answer
584 views

Yagarto: Do not include the standard header files

I am using a recompiled version of the GCC toolchain for the ARM platform, called Yagarto. The compiler comes with a "standard library" called Newlib, and "standard headers", such as ...
0
votes
2answers
98 views

Custom bootloader passing control to application code in STM32

I am trying to understand that if for STM32F405 MCU a custom bootloader is used on the MCU then each of the two projects for the custom bootloader and the application code will have their own 'startup....
0
votes
1answer
129 views

ARM strange behaviour clock speed

I am just starting with ARM and have made a small breakout board with an STM32F030 in TSSOP20 package. I've uploaded the following program which works when the clockspeed of the device is set to 8MHz ...
0
votes
1answer
4k views

Stm32f103 code examples? [closed]

I'm starting with a small dev board using the STM32F103C8T6. The learning curve is steep and I'm trying to find some examples regarding peripherals. I am using the Coocox IDE, the ARM GCC, and an ST-...
0
votes
1answer
371 views

STM32 PWM only works correctly when I leave in two unused variables: StartUpCounter and HSEStatus

I'm using the stm32f3discovery board to try and generate the signal for a ws2812 light strip. I've got src/system_stm32f30x.c, which I copied from the StdPeriph ...
0
votes
1answer
387 views

Renesas Compiler: KPIT vs GCC-Renesas (CyberThor)

When looking around at Renesas (RL78) compilers, I noticed GCC mentioned a decent amount, but the links are different. Many of the older (<= 2015) URLs point to an India company, KPIT, and is ...
0
votes
1answer
248 views

Errors on compiling the javacpp-present

I am trying to compiling the javacv in the beaglebone black. During compiling the javacpp-present. It shows the error ...
0
votes
1answer
2k views

STM32F4xx input pin reads wrong state on first run but not subsequent

I am working on a program which reads the state of a pin at startup to determine an operational mode. When I run the code on first power up, it reads incorrectly, but subsequent resets without power ...
0
votes
0answers
137 views

Bus fault when accessing mcu internal peripheral

I am struggling with a bus fault error on my samg55 µC based on arm cortex m4 architecture. The issue occurs sporadically and is not 100% reproductible. Let me give some details. Application code ...
0
votes
1answer
38 views

will i need header file “atxmega128.h” for porting from IAR to GCC?

i have a code for avr that write with iar, and have a header file,"ATxmega128A3.h. if i want to port this code to GCC (i am working with atmel studio),will i need to call this header file, or this ...
0
votes
0answers
256 views

How to share function or variable address between c and assembly filese in same project using GCC compiler on ARM Cortex M4

I am using a micro-controller with ARM Cortex M4 processor and GCC - GNU ARM compiler. Some functions are written in c in .c file and in assembly in .asm file. My questions are as follows : How can ...
-1
votes
1answer
1k views

Merge 2 chars from UART and convert into HEX value [closed]

I receive two characters from the UART: char UD[2] = {'B','8'} I need convert this into a hexadecimal value, like: ...