Updates to Keil RAW32 CPU specific scheduler.
Tested working on CortexM7 and CortexM7 with FP.
This commit is contained in:
parent
baa20c4e60
commit
06de6f1931
3 changed files with 27 additions and 3 deletions
|
@ -59,8 +59,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif GFX_COMPILER == GFX_COMPILER_KEIL || GFX_COMPILER == GFX_COMPILER_ARMCC
|
#elif GFX_COMPILER == GFX_COMPILER_KEIL || GFX_COMPILER == GFX_COMPILER_ARMCC
|
||||||
|
#define GFX_THREADS_DONE
|
||||||
|
#define _gfxThreadsInit()
|
||||||
|
|
||||||
static __asm void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
static __asm void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||||
|
PRESERVE8
|
||||||
|
|
||||||
// Save the old context
|
// Save the old context
|
||||||
push {r4, r5, r6, r7, lr}
|
push {r4, r5, r6, r7, lr}
|
||||||
mov r4, r8
|
mov r4, r8
|
||||||
|
@ -81,6 +85,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
||||||
|
PRESERVE8
|
||||||
|
|
||||||
// Calculate where to generate the new context
|
// Calculate where to generate the new context
|
||||||
// newt->cxt = (char *)newt + newt->size;
|
// newt->cxt = (char *)newt + newt->size;
|
||||||
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
||||||
|
@ -101,13 +107,15 @@
|
||||||
|
|
||||||
// Run the users function - we save some code because gfxThreadExit() never returns
|
// Run the users function - we save some code because gfxThreadExit() never returns
|
||||||
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||||
ldr r2,__cpp(&_gfxCurrentThread)
|
ldr r2,=__cpp(&_gfxCurrentThread)
|
||||||
ldr r2,[r2,#0]
|
ldr r2,[r2,#0]
|
||||||
ldr r0,[r2,#__cpp(offsetof(thread,param))]
|
ldr r0,[r2,#__cpp(offsetof(thread,param))]
|
||||||
ldr r1,[r2,#__cpp(offsetof(thread,fn))]
|
ldr r1,[r2,#__cpp(offsetof(thread,fn))]
|
||||||
blx r1
|
blx r1
|
||||||
mov r4,r0
|
mov r4,r0
|
||||||
bl __cpp(gfxThreadExit)
|
bl __cpp(gfxThreadExit)
|
||||||
|
|
||||||
|
ALIGN
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -45,8 +45,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif GFX_COMPILER == GFX_COMPILER_KEIL || GFX_COMPILER == GFX_COMPILER_ARMCC
|
#elif GFX_COMPILER == GFX_COMPILER_KEIL || GFX_COMPILER == GFX_COMPILER_ARMCC
|
||||||
|
#define GFX_THREADS_DONE
|
||||||
|
#define _gfxThreadsInit()
|
||||||
|
|
||||||
static __asm void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
static __asm void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||||
|
PRESERVE8
|
||||||
|
|
||||||
// Save the old context
|
// Save the old context
|
||||||
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
||||||
str sp, [r0,#__cpp(offsetof(thread,cxt))] // oldt->cxt
|
str sp, [r0,#__cpp(offsetof(thread,cxt))] // oldt->cxt
|
||||||
|
@ -57,6 +61,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
||||||
|
PRESERVE8
|
||||||
|
|
||||||
// Calculate where to generate the new context
|
// Calculate where to generate the new context
|
||||||
// newt->cxt = (char *)newt + newt->size;
|
// newt->cxt = (char *)newt + newt->size;
|
||||||
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
||||||
|
@ -72,13 +78,15 @@
|
||||||
|
|
||||||
// Run the users function - we save some code because gfxThreadExit() never returns
|
// Run the users function - we save some code because gfxThreadExit() never returns
|
||||||
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||||
ldr r2,__cpp(&_gfxCurrentThread)
|
ldr r2,=__cpp(&_gfxCurrentThread)
|
||||||
ldr r2,[r2,#0]
|
ldr r2,[r2,#0]
|
||||||
ldr r0,[r2,#__cpp(offsetof(thread,param))]
|
ldr r0,[r2,#__cpp(offsetof(thread,param))]
|
||||||
ldr r1,[r2,#__cpp(offsetof(thread,fn))]
|
ldr r1,[r2,#__cpp(offsetof(thread,fn))]
|
||||||
blx r1
|
blx r1
|
||||||
mov r4,r0
|
mov r4,r0
|
||||||
bl __cpp(gfxThreadExit)
|
bl __cpp(gfxThreadExit)
|
||||||
|
|
||||||
|
ALIGN
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -47,8 +47,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif GFX_COMPILER == GFX_COMPILER_KEIL || GFX_COMPILER == GFX_COMPILER_ARMCC
|
#elif GFX_COMPILER == GFX_COMPILER_KEIL || GFX_COMPILER == GFX_COMPILER_ARMCC
|
||||||
|
#define GFX_THREADS_DONE
|
||||||
|
#define _gfxThreadsInit()
|
||||||
|
|
||||||
static __asm void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
static __asm void _gfxTaskSwitch(thread *oldt, thread *newt) {
|
||||||
|
PRESERVE8
|
||||||
|
|
||||||
// Save the old context
|
// Save the old context
|
||||||
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
||||||
vpush {s16-s31}
|
vpush {s16-s31}
|
||||||
|
@ -61,6 +65,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
||||||
|
PRESERVE8
|
||||||
|
|
||||||
// Calculate where to generate the new context
|
// Calculate where to generate the new context
|
||||||
// newt->cxt = (char *)newt + newt->size;
|
// newt->cxt = (char *)newt + newt->size;
|
||||||
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
||||||
|
@ -77,13 +83,15 @@
|
||||||
|
|
||||||
// Run the users function - we save some code because gfxThreadExit() never returns
|
// Run the users function - we save some code because gfxThreadExit() never returns
|
||||||
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||||
ldr r2,__cpp(&_gfxCurrentThread)
|
ldr r2,=__cpp(&_gfxCurrentThread)
|
||||||
ldr r2,[r2,#0]
|
ldr r2,[r2,#0]
|
||||||
ldr r0,[r2,#__cpp(offsetof(thread,param))]
|
ldr r0,[r2,#__cpp(offsetof(thread,param))]
|
||||||
ldr r1,[r2,#__cpp(offsetof(thread,fn))]
|
ldr r1,[r2,#__cpp(offsetof(thread,fn))]
|
||||||
blx r1
|
blx r1
|
||||||
mov r4,r0
|
mov r4,r0
|
||||||
bl __cpp(gfxThreadExit)
|
bl __cpp(gfxThreadExit)
|
||||||
|
|
||||||
|
ALIGN
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Reference in a new issue