Questions tagged [cortex-m]
For all ARM Cortex-M series cores, including M0, M0+, M1, M3, M4, M7, M23 and M33.
884
questions
0
votes
0
answers
19
views
Question on when to use ISB/DMB in Cortex processors?
I am a bit confused on when/where to apply ISB/DMB instructions. On one hand it's portrayed that operations within the processor will always stay consistent on the otherhand it indicates things can be ...
3
votes
1
answer
47
views
How can I debug a HardFault on my STM32H743 when the recovered stack frame does not contain plausible information?
I am currently trying to track down the reason for a HardFault that sometimes occurs on my STM32H743.
I was able to narrow down the culprit to a section of code of about ~200 lines. Now of course I ...
2
votes
0
answers
21
views
llvm-mca for ARM Cortex-M cores
I'd like to use the llvm-mca tool to view execution timelines for instruction sequences in ARM Cortex-M cores, e.g. the Cortex-M4. I can see that there is support for in-order cores, but I'm not sure ...
0
votes
1
answer
57
views
How to add arguments to launch.json in VS Code
I am trying to debug the RP2040 using the new picoprobe.
When i execute the following command
openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"
OpenOCD works ...
1
vote
1
answer
39
views
Cortex M4 SVC code appears to always pass in 255 for the SVC number
I've tried following the documentation to make an SVC instruction work. From the Arm documentation here my SVC_Handler function is as they specify:
void SVC_Handler(void)
{
__asm(
".global ...
0
votes
0
answers
24
views
GDB and OpenOCD - Board resetting by itself when other threads are created
I'm running a board with STM32H750VBT6 microcontroller running NuttX and some application code.
For debug, I'm connecting to the target using GDB (cortex-debug extension in vscode) and OpenOCD.
My ...
2
votes
2
answers
49
views
PRIMASK on STM32F4
I have some old code for STM32F4 in which a critical section looks like
uint32_t primask;
primask = __get_PRIMASK();
__disable_irq();
/* ... Critical code ... */
__set_PRIMASK(primask);
I read in ...
4
votes
1
answer
65
views
STM32L151 fails to copy data segment from flash to SRAM
Been having a very weird issue with a specific build of a FW. When booting the device, I can see that SRAM isn't being filled with the data I'd expect, this should happen in the entry point function ...
1
vote
1
answer
87
views
Inserting inline assembly code into C function - I/O questions
I am developing an embedded C application for my Cortex M3 microcontroller using the GNU arm-none-eabi toolchain.
I have plan to adopt an assembly subroutine that the vendor implemented into my C ...
0
votes
0
answers
31
views
I want to know exception context save in Armv8-A aarch32
I know that registers r0~r3,r12,PSR,LR are saved when an exception call occurs in cortex-m.
But I'm confused that exception call in cortex-A
Q1. When a exception call occurs in cortex-A, it only saved ...
2
votes
2
answers
54
views
How to manage devices that cannot access d-cache in ARM
I'm using an SPI device with DMA enabled in an STM32H7 SoC. The DMA periph. cannot access d-cache, so in order to make it work I have disabled d-cache entirely (for more info. about this, see this ...
0
votes
3
answers
65
views
How to extend reset time during MCU software reset? (STM32F427)
I am solving a problem with the software reset of the STM32F427 microcontroller. Doing a software reset of the MCU is not a problem, it works great and the MCU boots up nicely.
During the software ...
2
votes
1
answer
72
views
Can I force a Cortex-M4 ARM processor to use conditional instructions outside an IT block?
I need to profile different machine instruction for a project, so I'm running some instructions in a loop of ~200 instructions per time (using .rept in an __asm__ directive). The processor I'm using ...
0
votes
1
answer
23
views
radare2 load register map
I'm reversing some stm32f030 code I downloaded from the chip. I do understand the stm32s and arm assembly but I'm completely new to radare2.
There are many special registers e.g. 0x40021000 is RCC_CR, ...
0
votes
0
answers
37
views
Is Software Generated Interrupt (SGI) an synchronous exception on ARMv8?
I am trying to write a bare metal application on an ARMv8 board. When I signal a SGI, the exception type of the SGI is synchronous while I am expecting it to be either FIQ or IRQ. Can I config it to ...
0
votes
1
answer
63
views
Bootloader Jump Function. How to Jump to the right Address?
I am trying to create a bootloader that jumps to my application code on a MKE02Z32VFM4 (KEO2 Series from Freescale). I am working with the Keil IDE 5 and the Armv6 Compiler v6.16.
After Issuing the ...
0
votes
0
answers
38
views
SRTH instruction causing unaligned memory access fault on Cortex M7
I have an IMXRT1060 and getting an unaligned access fault due to an STRH instruction. The odd thing is that the Cortex-M7 manual explicitly mentions that unaligned access are accepted for certain ...
0
votes
0
answers
46
views
Clearing or preventing pending interrupts in an ISR
Summary:
An ISR necessarily causes its own trigger pin to toggle randomly multiple times. These toggles (during the ISR) should be ignored, but aren't, and result in another interrupt to be set as ...
0
votes
1
answer
57
views
Measuring Cycle Count on an505 M33 Qemu
I'm trying to emulate an Arm cortex M33 using QEMU, using the an505 model. I've used this git repo as a starting point.
I've successfully built the project and even managed to debug into it however ...
0
votes
2
answers
55
views
Rust interop with FreeRTOS causes INVSTATE HardFault
I am working on an STM32F4 project with code generated by STM32CubeMX. In order to add some Rust to my project, I have ported the Makefile to CMake and am then using Corrosion to build and link a Rust ...
0
votes
0
answers
20
views
Comparing signed integers in ARM assembly using CMP [duplicate]
` MIN RN R1
COUNTER RN R2
P1 RN R0
AREA mycode, CODE, READONLY
ENTRY
EXPORT __main
__main
LDR ...
0
votes
0
answers
26
views
Renesas RA2 I2C Bootloader firmware update
I would like to have I2C bootloader for Renesas RA2E1. But I need an update via I2C to be supported.
IS anyone aware if Renesas have I2C bootloader? And if not, what would be the other option, is ...
1
vote
2
answers
93
views
Calculate MCU load (or free) time during operation
I have a Cortex M0+ chip (STM32 brand) and I want to calculate the load (or free) time. The M0+ doesn't have the DWT->SYSCNT register, so using that isn't an option.
Here's my idea:
Using a ...
0
votes
0
answers
100
views
How can I solve the error "Failed to parse flash type or unrecognized flash type" on STM32 board?
I tried to run the benchmarking code at here
When I try to flash the binary like st-flash write benchmark-kindi256342.bin 0x8000000, an error occurs as following.
st-flash 1.7.0-233-gc7bcb52
Failed to ...
0
votes
2
answers
81
views
Relocating interrupt vector table using linker script
I'm trying to move interrupt vector to DTCMRAM. The test code is simple blinking LED by timer interrupt.
There I've changed load adress of .isr_vector:
MEMORY
{
ITCMRAM (xrw) : ORIGIN = 0x00000000, ...
0
votes
0
answers
34
views
Cortex-M remote target with LLDB script
I'm currently able to connect, load and debugg a Nucleo-G0B1 board with LLDB and pyOCD (also with OpenOCD) using the following sequence of commands:
$ lldb Build/temp.elf
(lldb) gdb-remote 127.0.0.1:...
0
votes
2
answers
76
views
Starting program from address memory different to 0x0000
I have simple program where as usual the program is located at the memory 0x0000, and the data is located at 0x20100000 as shown below.
when I run the simulator and press botton "reset", ...
5
votes
2
answers
271
views
setting stack pointer before jumping to app from bootloader
I am coding a bootloader for Nucleo-F429ZI. I have two different STM32 projects, one for the bootloader itself and an application to jump from the bootloader.
Linker script for bootloader
MEMORY
{
...
0
votes
0
answers
516
views
J-link Failed to attach to CPU, connect under reset failed
Trying to connect to J-Link to my PCB and when trying to connect, this is message appears. Was able to connect and flash the drive, but after like 30 seconds, when trying to connect again, this error ...
1
vote
1
answer
66
views
Why can't a constant address be computed in a bitfield?
I'm trying to implement a constant linked DMA descriptor list (in ROM) on an Silabs EFR32BG22, where the last descriptor links to another descriptor located in RAM.
I'm using arm-none-eabi-gcc 10.2 (...
4
votes
1
answer
196
views
ARM Cortex-M7 assembly timing on simple delay loop - how to explain results?
Since AFAIK cycle timings are not published, I've decided to try to measure cycle count using DWT counter on STM32H750-DK; as a first example, I'm measuring a simple delay loop.
It seems that two ...
0
votes
0
answers
39
views
How to enable remoteproc and rpmsg in Google Coral Dev Board (NXP i.MX 8M)
Hi I'm using a Google coral with NXP i.MX 8M and I'm trying to enable communication between Cortex-A53 and Cortex M4F. For that I need the remoteproc and rpmsg.
So I already flashed the Mendel OS on ...
1
vote
1
answer
77
views
Cortex-M7 (M4) SVCall from another ISR: executes when SVCall has higher priority, straight to the hardfault otherwise
Context: writing RTOS, have working scheduler, context switcher, etc. Implementing SVCall now. Main test/dev platform is STM32F746-Disco Cortex-M7, also works on STM32F469 disco with Cortex-M4.
My ...
5
votes
1
answer
322
views
How to implement atomic operation(s) on multi-core Cortex-M0/M0+ (no SWP, no LDREX/STREX)?
Pre ARMv6 MPUs/MCUs have SWP instruction (e.g. good ole and still alive ARM7TDMI). In ARMv6 architecture LDREX/STREX pair has been introduced and SWP removed. However with one exception – ARMv6-M (...
0
votes
1
answer
124
views
How to halt a target device with pyocd?
I try to halt a F746zg core with pyocd via ST-LinkV2. The ST-Link sees the core. But I'm not able to erase and reprogram it until it's halted. Does anyone know what the right command is to do that?
I ...
0
votes
1
answer
97
views
ARMv7-M Cortex-M7 Cache Policy: Inner vs Outer, internal SRAM and external SDRAM
Context: Cortex-M7 STM32F746 Disco, writing own RTOS. Implementing memory policies for different memory regions for threads.
I've been writing my own RTOS kernel for the sake of understanding how ...
0
votes
0
answers
67
views
Cortex M33 unable to get stack pointer and pc from word offset 0/1 with qemu
I tried to bringup cortex m33 with QEMU, and I used board MPS2-AN505, but QEMU always abort with HardFault error, so I checked system registers with GDB and I found that the T bit of ESPR reg is 0 ...
0
votes
1
answer
47
views
ISR entered without any enabled when no interrupt flag is set. Double firing?
I am using the ADC on my STM32L431 with both DMA and interruption. Everything works fine, except that the ISR is often entered with none of the enabled interrupt flag being set.
Initial ISR code:
...
0
votes
1
answer
173
views
Azure RTOS ThreadX with STM32L476VG
I would like to install threadX on a STM32L476VG. I am quite new to RTOS programming.
As I set up some simple applications I run into a HardFault whenever I called the tx_thread_resume function within ...
0
votes
1
answer
46
views
ARM Cortex-M3: Store digits/string in memory
I'm studying ARM Cortex-M3 with Thumb-2 instruction. I found some code that declares some data areas.
AREA RESET, DATA, READONLY
DULIEU DCB &0F,&0D,&7,&0A
The first code is for ...
1
vote
0
answers
112
views
Why doesn't my conditional Branch and Link Statement work?
I am relatively new to the world of ARM so I apologize if I am missing something obvious. For some context, this code is being executed on a microcontroller based on the ARM Cortex-M4F.
When running ...
0
votes
2
answers
132
views
Cannot write to STM32 (Cortex M4) ISERx, STIR Register
I am trying to manually set the ISER0 and STIR registrs to invoke interrupt number 3 which is RTC Wakeup Interrup for educational purposes. Here is my code:
I step through the register contents, but ...
0
votes
1
answer
190
views
Clang-15 vs Clang-14 local static init guards
I'm using Clang++ to compile for a Cortex-M0+ target, and in moving from version 14 to version 15 I've found a difference in the code generated for guard variables for local statics.
So, for example:
...
1
vote
1
answer
67
views
ARMv7E-M VCVT.F32.U32 encoding
I'm writing an ARMv7E-M Thumb2 binary analysis tool, and decoding the instruction stream manually.
arm-gcc, invoked with the -mcpu=cortex-m4 and -mfloat-abi=hard flags, emitted the following ...
1
vote
1
answer
40
views
Delay Loop Printing Integers in Assembly
I'd like to make a quick program in assembly for the ARM Cortex M4 architecture that prints a consecutive integer every 2 seconds. So every 2 seconds, it goes 1, 2 and so on. Since this architecture ...
0
votes
1
answer
121
views
TensorFlow Lite for ARM - Cortex M
I’d like to ask if there is TensorFlow Lite that should run ML models on mobile, embedded, and edge devices available for microcontrollers having cores: ARM Cortex M7, ARM Cortex M55/M33?
If not, what ...
2
votes
1
answer
175
views
Is there something like ATOMIC_INC in CMSIS for Cortex-M 3 4 7?
Cortex M 3 4 7 support LDREX and STREX assembler instructions and with these CMSIS provides for example ATOMIC_MODIFY_REG that ensures an atomic modification of an (u)int32_t (ie clear some bits and ...
0
votes
2
answers
83
views
Why a variable would not be allocated as local in stack
I'm trying to force a buffer overflow to change the value of a variable. The idea is to overflow var_a to change var_b in the following code, which runs Contiki-NG operating system in an ARM Cortex-M4:...
0
votes
1
answer
619
views
Emulate ARM Cortex-M7 with qemu-system-arm.exe
I'm using Eclipse based CubeIDE and QEMU debugging plugin.
I'm working in assembler and can debug simple project (adding two numbers in registers) on STM32 Cortex M7 board (STM32H750DK). Now I'd like ...
4
votes
1
answer
296
views
Profiling memcpy performance on Cortex-M7 (stm32f7)
SHORT VERSION:
Performance metrics of the memcpy that gets pulled from the GNU ARM toolchain seem to vary wildly on ARM Cortex-M7 for different copy sizes, even though the code that copies the data ...