Write a Stm32 svc shutdown interrupt function

Source: Internet
Author: User

Do let Stm32 trigger Svc interrupt and pass in parameters and then switch to handler mode and modify the value of the special register, so as to achieve the shutdown interrupt, but in fact this program is directly privileged level, so do not enter handler mode can also modify the special register ...

The following is a call to write the switch interrupt function:

Created a new file asm.c, all of the assembly functions I wrote are in:

The first two are off interrupts and open interrupt functions, the main thing to do is to pass parameters into the R8 and triggers the SVC interrupt.

A third set_i () function is called in the SVC interrupt.

When the interrupt is triggered, the M3 kernel enters handler mode, using the data in the R8 to modify the special register Basepri. This register can only be accessed at privileged levels.

Stm32 interrupts are grouped into group 1 with a priority number of 4, so a preemption priority of 1 interrupts is masked. Only the TIM3 interrupt preemption priority is 0, so only a tim3 interrupt can be performed after the first function is called.



From for notes (Wiz)

Write a Stm32 svc shutdown interrupt function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.