cortex-m3

Change priority level level of running interrupt handler?

前提是你 提交于 2021-01-27 05:49:23
问题 I am trying to implement the following pseudocode on a cortex-m3 controller, (STM32L151 in particular) void SysTick_Handler() { do_high_priority_periodic_tasks(); // not to be interrupted lower_interrupt_priority(); do_low_priority_periodic_tasks(); // these may be interrupted } In other words, run the first part with priority level 0, then somehow lower the current interrupt priority to 15, so that the rest could be preempted by other hardware interrupts. One idea is to move do_low_priority

ARM Cortex-M3 boot from RAM initial state

爱⌒轻易说出口 提交于 2021-01-21 05:56:51
问题 I have two ARM Cortex-M3 chips: STMF103C8T6 and STM32F103VET6 . When set to boot from RAM, initial state of STMF103C8T6 PC register is 0x20000108 ; 0x200001e0 for STM32F103VET6 . I am unable to find and information about these addresses in the datasheets. Why are they booted this way and where I can find some information about it? Edit: To clarify. When chip set to boot from flash, PC register points to the location of the Reset Handler. This address is provided in the reset vector table at

ARM Cortex M4 SVC_Handler “UsageFault”

北城余情 提交于 2020-07-19 18:44:47
问题 I'm creating a context switch program for a personal mini ARM kernel project and the context switch program is written entirely in Assembly. The problem is when I make a SVC call (svc 0) I enter the SVC_Handler but when I try to execute the next instruction I then enter a different handler ("UsageFault_Handler"). The fault occurs before I can pop any of the registers in the SVC_Handler. Here's a register dump of my gdb screen (right after I enter SVC_Handler and encounter UsageFault_Handler):

ARM Cortex M4 SVC_Handler “UsageFault”

岁酱吖の 提交于 2020-07-19 18:44:13
问题 I'm creating a context switch program for a personal mini ARM kernel project and the context switch program is written entirely in Assembly. The problem is when I make a SVC call (svc 0) I enter the SVC_Handler but when I try to execute the next instruction I then enter a different handler ("UsageFault_Handler"). The fault occurs before I can pop any of the registers in the SVC_Handler. Here's a register dump of my gdb screen (right after I enter SVC_Handler and encounter UsageFault_Handler):

ARM Cortex M4 SVC_Handler “UsageFault”

孤者浪人 提交于 2020-07-19 18:43:05
问题 I'm creating a context switch program for a personal mini ARM kernel project and the context switch program is written entirely in Assembly. The problem is when I make a SVC call (svc 0) I enter the SVC_Handler but when I try to execute the next instruction I then enter a different handler ("UsageFault_Handler"). The fault occurs before I can pop any of the registers in the SVC_Handler. Here's a register dump of my gdb screen (right after I enter SVC_Handler and encounter UsageFault_Handler):

基于Cortex-M3的简易操作系统——简易任务调度(一)

亡梦爱人 提交于 2020-02-07 23:27:26
一、引言 上一次简单的记录了一下我学习用Cortex-M3写一个最小调度系统的过程,但大多是图片的堆砌,所以现在准备写一个基于Cortex-M3的简易操作系统的系列,也算记录一下学习操作系统的过程。 本系列使用基于Cortex-M3内核的STM32F103RCT6作为平台 代码开源在gitee上,大家可以自行下载: https://gitee.com/dwk88/SimpleOS 二、预备知识 本文默认你学习并实际开发过Cortex-M系列的的单片机,例如:STM32,Tiva等,熟悉汇编知识 你还需要了解Cortex-M3包含的寄存器以及它们的功能 首先我们来思考一个问题:如何让多个任务同时进行(并行),例如:算法程序计算(长时间占用MCU)和数据传输、显示、外部控制 要知道我们的单核MCU是无法同时执行两条指令的,要并行运行多个任务必然要多个MCU,但那样协调性和成本都是问题。 我们做不到并行,所以折中的解决方案是使用一个调度程序,周期性的切换执行的任务。 三、时间片轮转调度算法 时间片轮转的意思是,以一个固定的时间周期,每隔一段时间就切换MCU执行的任务。 下面举一个列子: void task1(void) { while(1) { GPIO_PinWrite(LED_Red.port, LED_Red.num, 1); Delay_ms(500); GPIO

How to obtain reliable Cortex M4 short delays

蓝咒 提交于 2020-02-06 04:54:34
问题 I am porting some code from an M3 to an M4 which uses 3 NOPs to provide a very short delay between serial output clock changes. The M3 instruction set defines the time for a NOP as 1 cycle. I notice that NOPs in the M4 do not necessarily delay any time at all. I am aware that I will need to disable compiler optimisation but I'm looking for a low level command that will give me reliable, repeatable times. In practice in this particular case the serial is used very occasionally and could be

How do I debug unexpected resets in a STM32 device?

戏子无情 提交于 2020-01-30 14:40:30
问题 I'm doing some development in C with a STM32F107 chip and, at some point, the device began to reset when I call a specific function. I don't have a debugger and my debugging is just plain text over a serial port. I've used some other microcontrollers in which I was able to access a register to see the cause of the reset, but I can't seem to find an equivalent for this device. I'm aware of the hardware exceptions of the Cortex-M3, but I don't know if one of them is being triggered since I can