Questions tagged [cortex-m]

For all ARM Cortex-M series cores, including M0, M0+, M1, M3, M4, M7, M23 and M33.

Please use this tag instead of other specific Cortex-M tags See: Merge ARM tags.

This tag is for questions related to the ARM Cortex-M microcontrollers.

The Cortex-M microcontrollers support the Thumb 2 instruction set, have a Nested Vector Interrupt Controller (NVIC) that allows interrupt handlers to be written purely in C without any assembly programming and is optimized for cost and power sensitive applications such as smart metering, human interface devices, automotive and industrial control systems, consumer electronics and medical instrumentation.

For a generic introduction and comparisons to other microcontroller families, see:

References:

See also:

725 questions
34
votes
3 answers

How to create a QEMU ARM machine with custom peripherals and memory maps?

I am writing a code for Cortex-M3 cpu and I am performing unit testing using qemu-arm binary. For now everything works just fine. But I am wondering If I am able to test whole system using qemu-system-arm? I mean, I want to write custom "machine"…
mucka
  • 1,159
  • 2
  • 20
  • 28
28
votes
11 answers

Generate sine signal in C without using the standard function

I want to generate a sine signal in C without using the standard function sin() in order to trigger sine shaped changes in the brightness of a LED. My basic idea was to use a lookup table with 40 points and interpolation. Here's my first…
Peter123
  • 547
  • 1
  • 5
  • 12
16
votes
3 answers

Fastest way to work with unaligned data on a word-aligned processor?

I'm doing a project on an ARM Cortex M0, which does not support unaligned(by 4bytes) access, and I'm trying to optimize the speed of operations on unaligned data. I'm storing Bluetooth Low Energy Access addresses (48bit) as 6-byte arrays in some…
dromtrund
  • 235
  • 2
  • 7
13
votes
3 answers

ARM M4 Instructions per Cycle (IPC) counters

I would like to count the number of Instructions per Cycle executed on an ARM cortex-M4 (or cortex-M3) processor. What it's needed is: number of instructions (executed at runtime) of the code I want to profile and number of cycles that the code…
FrankPak
  • 349
  • 3
  • 19
12
votes
2 answers

Understanding the linkerscript for an ARM Cortex-M microcontroller

I am using the STM32F746NG microcontroller from STMicroelectronics. This device is based on the ARM Cortex-M7 architecture. I invested quite some time in understanding the linkerscript from example projects. I figured out the basics, but I still…
K.Mulier
  • 6,430
  • 9
  • 58
  • 110
12
votes
3 answers

C++ exception handler on gnu arm cortex m4 with freertos

Update 2016-12 There is now also a minimal example for this behavior: https://community.nxp.com/message/862676 I'm using a ARM Cortex M4 with freertos using freescales freedom Kinetis IDE (gnu arm toolchain). Problem is that try { throw 4; //…
Superlokkus
  • 3,784
  • 1
  • 17
  • 49
12
votes
3 answers

ARM Cortex-M compiler differences

I'm about to develop some firmwares for Cortex-M cores on STM32 processors using C for my projects, and searching on the web I've found a lot of different compilers: Keil, IAR, Linaro, Yagarto and GNU Tools for ARM Embedded Processors. I was…
Fabio Angeletti
  • 161
  • 2
  • 8
11
votes
1 answer

Exact copy of machine code runs 50% slower than the original function

I've been experimenting a bit with execution from RAM and flash memory on embedded systems. For rapid prototyping and testing I'm currently using an Arduino Due (SAM3X8E ARM Cortex-M3). As far as I can see, the Arduino runtime and bootloader should…
fscheidl
  • 2,269
  • 3
  • 17
  • 33
11
votes
3 answers

Simulating LDREX/STREX (load/store exclusive) in Cortex-M0

In the Cortex-M3 instruction set, there exist a family of LDREX/STREX instructions such that if a location is read with an LDREX instruction, a following STREX instruction can write to that address only if the address is known to have been…
supercat
  • 69,493
  • 7
  • 143
  • 184
11
votes
2 answers

Bootloader for Cortex M3

I am using a LPC 1768 board from mbed, (with cortex M3 cpu) and I am trying to achieve something here, mainly upgrade the user application from the SD Card, I am writing two programs, first a bootloader/nano-kernel, and a user-app (helloworld will…
batmat
  • 225
  • 1
  • 5
  • 15
10
votes
1 answer

STM32 internal clocks

I am confused with the clock system on my STM32F7 device (Cortex-M7 microcontroller from STMicroelectronics). The reference manual does not clarify the differences between these clocks sufficiently: SYSCLK HCLK FCLK The reference manual reads in…
K.Mulier
  • 6,430
  • 9
  • 58
  • 110
10
votes
2 answers

Declaring abstract class (pure virtual method) increase binary size substantially

Here is the story: I am developing C++ software for ARM Cortex-M0 processor in Linux with AC6 Toolpack. Before I was using Keil (in windows) (who has their own toolchain) and I have migrated to GNU-toolchain ((GNU Tools for ARM Embedded Processors)…
ifyalciner
  • 1,050
  • 1
  • 10
  • 20
10
votes
2 answers

undefined reference to `__aeabi_ddiv' and friends - building without stdlib but with -mfloat-abi=hard

I'm trying to build a project for Cortex-M4F. The Chip has a FPU, so I'm building with -mfpu=fpv4-sp-d16 -mfloat-abi=hard and I'm not using any libraries in order to save space, so I do -nostdlib -fno-builtin. Now I want to use floating point…
user1273684
  • 1,169
  • 11
  • 22
9
votes
2 answers

arm sleep mode entry and exit differences WFE, WFI

I am reasonably new to the ARM architectures and I am trying to wrap my head around the wake up mechanism. So first of all I am finding it difficult to find good info on this. ARM's documentation seems to be very terse on the topic. What I'd like…
Gregory Kuhn
  • 1,371
  • 1
  • 15
  • 26
9
votes
1 answer

Hardfault on STM32F030 startup, __libc_init_array

I'm trying to get a STM32Cube project compiled using arm-none-eabi-gcc and a Makefile. I have specified: CFLAGS = -mthumb\ -march=armv6-m\ -mlittle-endian\ -mcpu=cortex-m0\ -ffunction-sections\ …
evading
  • 2,808
  • 2
  • 35
  • 48
1
2 3
48 49