Comments (7)
Not manually, For Armv7-M ISA based CPU like Cortex-M7, caller save registers (r0-r3,r12,LR(r14),PC(r15), xPSR) would be saved into stack by hardware, and r4-r9, r10,r11,SP would be saved by callee functions, save and restore instructions would be generated by compilers, so for C programmers, no manual procedure is required to save/restore contexts.
from threadx.
Hi @rayc345
Threadx context save/restore not only saves register, but also manages the option that while the interrupt happened something that requires context switch. For this case stuff needed to be stored on the stack and context restore returns from the interrupt to the scheduler instead of to the original point where the interrupt was called from.
And hence I think the answer to @maxkunes is that indeed it should be called from assembly code.
from threadx.
@amgross Thank you for the reply.
Honestly, I've been working with ThreadX for 3 years now without doing this, and I've yet to see anything that is obviously wrong.
Can you explain what behavior might be seen in theory without these calls? Maybe I have some intermittent bugs due to this that I haven't connected to anything else.
from threadx.
Hi @maxkunes ,
By 'without doing it' you mean you call it from C code or not calling it at all?
from threadx.
from threadx.
Surprisingly (for me), it seems like I was mistaken and there is no need for cortex M to use save/restore
threadx/ports/cortex_m7/ac5/readme_threadx.txt
Lines 161 to 173 in 485a02f
So @rayc345 is correct
from threadx.
from threadx.
Related Issues (20)
- _tx_semaphore_created_ptr is always NULL HOT 3
- The interrupt vector table offset register should not be set.
- tx_byte_pool service fragmentation problem HOT 3
- How to include threadx in the project via CMake system? HOT 2
- Dose threadx module has 'who am I' utility?
- Certification Package for Eclipse ThreadX HOT 2
- ULONG == uint32_t in 64-bit system cause problem HOT 1
- Fix CMake minimum require version warning
- vfp_enable breaks FileX on Cortex-R5 HOT 1
- Consider declaring the name of the entities as "CHAR const *" instead of "CHAR *" HOT 2
- tx_queue_receive not checked that TX_QUEUE inited.
- ThreadX Context Save/Restore of Floating Point Registers for Cortex-R5 HOT 2
- Consulting HOT 4
- support for hardware stack checking in ARC HS
- FPU support RISCV-64 HOT 1
- Release Cadence HOT 2
- Stack Checking for 64 bit ?
- Why is the file tx_initialize_low_level.S part of the port in case of cortex_m33 and doesn't have the possibility to change the SYSTEM_CLOCK?
- Will ThreadX support osDelayUntil function in the future? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from threadx.