Questions tagged [cortex-m]

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

cortex-m
Filter by
Sorted by
Tagged with
0 votes
2 answers
56 views

Can I light up the LED at the reset interrupt point

Based on Cortex-M4,GNU compiler. what i want to do is through a store instruction store a word to an address which is belongs a light's GPIOx_ODR(output mode as default).so i can light up led without ...
jack wen's user avatar
1 vote
1 answer
316 views

Is there a way to save last address that cause hardware fault or any while(1) in a COrtex M0+?

Working on a STM32G0B0 (Cortex M0+), recently I have a problem with IWDG (independent watch dog). Despite I never made it work properly as windowed one, it works decently as normal watchdog. I set it ...
yo3hcv's user avatar
  • 1,569
1 vote
0 answers
255 views

STM32 and SP value at startup: should the reset handler set SP manually?

I am experiencing a sporadic bug on some STM32F7s. While usually SP register takes its initial value from reset vector (stored in persistent read-only memory), sometimes it is initially set to an ...
Giuseppe Guerrini's user avatar
0 votes
0 answers
20 views

What does the "Access" attribute mean in the bit [0] of the MEMATTRS signal from the CortexM4 IP and how do I assert the same

I wanted to know how to set the allocate bit (bit[0]) of the MEMATTRS signal (of the system bus) in the cortex m4 IP. What do I configure to get the bit to toggle? Also, I couldn't find any ...
cher's user avatar
  • 11
2 votes
0 answers
88 views

ARM Cortex-M3 Reference manual mentioning LDR Rx!,[any] as a valid instruction?

When reading through the Cortex-M3 reference manual there is a section called Load/Store timings (3.3.2) where they discuss ways to minimize the number of clock cycles a Load/Store instruction takes. ...
Bas's user avatar
  • 891
1 vote
0 answers
78 views

How to import paths or compile openssl in STMCube IDE?

I want to use one of the openssl pkey demos code on STMCube IDE and I am running into errors. I think I'm using wrong paths or not including makefile stuff in my IDE. I need help with that. I keep ...
minion's user avatar
  • 95
0 votes
1 answer
113 views

gcc, arm, inline assembly, BX produce unexpected results trying to jump over a goto section

I am using Cortex M0+; I am trying to preserve a piece of code inside the regular code flow, don't ask me why :) Basically later on, I'd like to jump to MYCODE. This is the code bool x = false; // ...
yo3hcv's user avatar
  • 1,569
0 votes
0 answers
352 views

Bootloader for ARM Cortex-M4F (SOLVED)

I'm trying to add a bootloader to an ATMEL ATSAME54N19A microcontroller (Cortex-M4F with 512 KB of flash). I'm using MPLAB IPE (Microchip's programming environment) and xc32 (Microchip's compiler ...
user3214726's user avatar
0 votes
2 answers
87 views

STM32 sometimes hardfault on reboot (thumb instruction issue?)

STM32L496 micro is hard faulting when power is cycled, but only on some builds of firmware, others are ok. I've been able to track it down to a specific path in the assembly, what looks like is ...
Nick Fritz's user avatar
1 vote
2 answers
496 views

what does the cortex-M4's initial SP value in the 0x0 use for?

through the Cortex-M4 Devices Generic User Guide, could find a initial sp value in the 0x0. through startup_stm32l431xx.s, could find Reset_Handler: ldr sp, =_estack /* Set stack pointer */ //...
jack wen's user avatar
0 votes
2 answers
296 views

STM32 reset events handling

Is there a way to generate falling and rising events on the reset pin of STM32L0xx? The idea is to do a regular hw reset it when quick pressed when pressed and hold to load the factory settings. Thank ...
Daniel Nik's user avatar
1 vote
2 answers
113 views

why Entry point address is 0x800107d,but first instruction start 0x800107c

using arm-none-eabi-readelf -h ideself.elf could find: Entry point address: 0x800107d using arm-none-eabi-objdump -D ideself.elf could find: 0800107c <Reset_Handler>: ...
jack wen's user avatar
1 vote
1 answer
348 views

How should I cross-compile for the ARM Cortex-m4 STM32F407VGT6 with Clang?

First, a brief detour to avoid the XY problem: I need to experiment with LLVM on an ARM board (the Discovery kit STM32F407G). So, I cloned and built the recent (and official?) LLVM embedded toolchain ...
Alessandro Bertulli's user avatar
0 votes
0 answers
114 views

Program Counter value shifted/corrupted. Cortex M4 (STM32)

I have an application (and bootloader) that every couple times power is cycled, will hard fault on bootup (after bootloader) otherwise works just fine. I've done some troubleshooting and ...
Nick Fritz's user avatar
0 votes
1 answer
138 views

Cortex M4 invalid frame address during Hardfault

I'm trying to debug a Hardfault I'm getting at my Cortex-m4 MCU (ATSAM4E16). I've been reading https://interrupt.memfault.com/blog/cortex-m-hardfault-debug and https://www.freertos.org/Debugging-Hard-...
andypandy's user avatar
0 votes
1 answer
177 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. ...
Bil_Bomba's user avatar
  • 181
0 votes
0 answers
141 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 ...
FourierFlux's user avatar
3 votes
1 answer
509 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 ...
Jonarw's user avatar
  • 61
1 vote
0 answers
205 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 ...
swineone's user avatar
  • 2,588
1 vote
1 answer
2k 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 ...
varun koganti's user avatar
1 vote
1 answer
313 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 ...
Michael Stachowsky's user avatar
0 votes
0 answers
100 views

Startup File default handlers for SysTick

I'm using the STM32F030 and CubeIDE and am trying to rationalize my own code and build some libraries to share across projects. In the current project I don't need to do anything upon SysTick but ...
ElecDesigner's user avatar
0 votes
1 answer
102 views

Can you programmatically remove breakpoints in ARM Cortex M3 application at runtime?

In my bare metal C application for a CM3, I have a startup script that runs a CRC on code and data sections in their target regions in memory. I noticed sometimes the check on code would fail, ...
us3rnotfound's user avatar
0 votes
0 answers
97 views

Tiva C TM4C123GXL digital outputs problem

I didn't find the same problem like my anywhere, but I hope someone have any advices what happenin with my uC. Digital outputs are very "sensitive / delicate". Namely, I have connected PC4-...
PatrykL's user avatar
1 vote
0 answers
77 views

rp2040_hal SPI initialisation no read, write, transfer function

My struct has a member which is a SPI type from the docs. pub struct TMC429<D, CS, const DS: u8> where D: SpiDevice, CS: OutputPin, CS::Error: core::fmt::Debug { spi: Spi<...
elhe's user avatar
  • 132
2 votes
2 answers
1k 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 ...
Giuseppe Guerrini's user avatar
4 votes
1 answer
262 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 ...
kruml's user avatar
  • 43
0 votes
0 answers
219 views

Booting the CPU through JTAG debugger. How to exit from debug state and start from newly added PC address

I would like to use the DAP interface in the cortexm4 processor to download application code into a memory that can be accessed by a JTAG debugger. For now, I wanted to follow the following steps ...
cher's user avatar
  • 11
0 votes
1 answer
95 views

On STM32L476, should I still use a mutex to guard a single byte variable if ARMv7-M guarantees single-copy atomicity for byte length variables?

I am using an STM32L476 with CMSIS OS2 which implements FreeRTOS v10.3.1. The L4 is a Cortex-M4 MCU which implements ARMv7E-M architecture: https://en.wikipedia.org/wiki/ARM_Cortex-M The difference ...
tom.nowak's user avatar
1 vote
1 answer
544 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 ...
us3rnotfound's user avatar
3 votes
2 answers
817 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 ...
Dan's user avatar
  • 2,572
0 votes
3 answers
475 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 ...
user1313386's user avatar
2 votes
1 answer
291 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 ...
Alessandro Bertulli's user avatar
0 votes
1 answer
81 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, ...
Scheintod's user avatar
  • 8,064
0 votes
0 answers
132 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 ...
zoey1771's user avatar
0 votes
1 answer
107 views

Cortex M0+/GCC Division with Rounding

I'm trying to implement an integer division with rounding. Obviously, by default integer division does floor and I was thinking I could use the remainder to determine if I should add 1 to my result. ...
spizzak's user avatar
  • 1,127
0 votes
1 answer
511 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 ...
Archy's user avatar
  • 31
1 vote
0 answers
99 views

Can a JTAG debugger access CORTEXM4 processor registers like DHCSR to enable Reset Vector Catch while the processor is in reset state.?

I wanted to know if a JTAG debugger can access debug enabling registers of CORTEXM4 like DHCSR while the Power on reset and System reset has been asserted. Or do we deassert only the Power On Reset ...
cher's user avatar
  • 11
0 votes
0 answers
90 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 ...
Alex's user avatar
  • 73
2 votes
1 answer
337 views

ARM GCC + Cortex M4: Calling address as function generates BLX instead of BL

I build as little OS for a CortexM4 CPU which is able to receive compiled binaries over UART and schedule them dynamically. I want to use that feature to craft a testsuite which uploads test programs ...
wolfbiker1's user avatar
0 votes
0 answers
242 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 ...
aulven's user avatar
  • 521
0 votes
1 answer
377 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 ...
cberk1's user avatar
  • 33
0 votes
1 answer
211 views

Configuring 256 different priority levels for each interrupt in ARM Cortex-M4

I am working with ARM Cortex-M4 interrupts. I had enabled the core to handle a maximum of 240 interrupts. I have also enabled the interrupts. But while trying to set the priority of the interrupts, I ...
cher's user avatar
  • 11
0 votes
2 answers
120 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 ...
Gerharddc's user avatar
  • 4,001
1 vote
2 answers
622 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 ...
ConductedForce's user avatar
0 votes
0 answers
334 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 ...
Yong Ryeol Choi's user avatar
0 votes
2 answers
590 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, ...
mohammadsdtmnd's user avatar
0 votes
2 answers
364 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", ...
arlen's user avatar
  • 35
5 votes
2 answers
1k 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 { ...
h_enes_simsek's user avatar
0 votes
0 answers
2k 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 ...
Wei's user avatar
  • 1

1 2
3
4 5
29