Cortex-M4 FPU support working.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3644 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
cefffe9013
commit
6100dc08a6
|
@ -76,6 +76,7 @@ void SVCallVector(void) {
|
||||||
#if CORTEX_USE_FPU
|
#if CORTEX_USE_FPU
|
||||||
/* Restoring the special register SCB_FPCCR.*/
|
/* Restoring the special register SCB_FPCCR.*/
|
||||||
SCB_FPCCR = (uint32_t)ctxp->fpccr;
|
SCB_FPCCR = (uint32_t)ctxp->fpccr;
|
||||||
|
SCB_FPCAR = SCB_FPCAR + sizeof (struct extctx);
|
||||||
#endif
|
#endif
|
||||||
asm volatile ("msr PSP, %0" : : "r" (ctxp) : "memory");
|
asm volatile ("msr PSP, %0" : : "r" (ctxp) : "memory");
|
||||||
port_unlock_from_isr();
|
port_unlock_from_isr();
|
||||||
|
@ -102,6 +103,7 @@ void PendSVVector(void) {
|
||||||
#if CORTEX_USE_FPU
|
#if CORTEX_USE_FPU
|
||||||
/* Restoring the special register SCB_FPCCR.*/
|
/* Restoring the special register SCB_FPCCR.*/
|
||||||
SCB_FPCCR = (uint32_t)ctxp->fpccr;
|
SCB_FPCCR = (uint32_t)ctxp->fpccr;
|
||||||
|
SCB_FPCAR = SCB_FPCAR + sizeof (struct extctx);
|
||||||
#endif
|
#endif
|
||||||
asm volatile ("msr PSP, %0" : : "r" (ctxp) : "memory");
|
asm volatile ("msr PSP, %0" : : "r" (ctxp) : "memory");
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,8 @@
|
||||||
structures and stacks in the CCM RAM instead normal RAM. It is done using
|
structures and stacks in the CCM RAM instead normal RAM. It is done using
|
||||||
a special .ld file that can be customized to decide how to allocate data
|
a special .ld file that can be customized to decide how to allocate data
|
||||||
in the various RAM sections.
|
in the various RAM sections.
|
||||||
- NEW: Added support for the Cortex-M4 FPU (default when the FPU is present).
|
- NEW: Added experimental support for the Cortex-M4 FPU (default when the
|
||||||
|
FPU is present).
|
||||||
- NEW: Improved I2C driver model and STM32 implementation by Barthess.
|
- NEW: Improved I2C driver model and STM32 implementation by Barthess.
|
||||||
|
|
||||||
*** 2.3.4 ***
|
*** 2.3.4 ***
|
||||||
|
|
|
@ -39,10 +39,6 @@ float ff2(float par1, float par2, float par3, float par4);
|
||||||
#define ITERATIONS 100
|
#define ITERATIONS 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NUM_THREADS
|
|
||||||
#define NUM_THREADS 4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Test related code. */
|
/* Test related code. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -50,9 +46,9 @@ float ff2(float par1, float par2, float par3, float par4);
|
||||||
static bool_t saturated;
|
static bool_t saturated;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test worker threads.
|
* Test worker thread.
|
||||||
*/
|
*/
|
||||||
static WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
|
static WORKING_AREA(waWorkerThread, 128);
|
||||||
static msg_t WorkerThread(void *arg) {
|
static msg_t WorkerThread(void *arg) {
|
||||||
|
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
@ -71,11 +67,34 @@ static msg_t WorkerThread(void *arg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test periodic thread.
|
||||||
|
*/
|
||||||
|
static WORKING_AREA(waPeriodicThread, 128);
|
||||||
|
static msg_t PeriodicThread(void *arg) {
|
||||||
|
|
||||||
|
(void)arg;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
float f1, f2, f3, f4, f5;
|
||||||
|
|
||||||
|
f1 = ff1(4);
|
||||||
|
f2 = ff1(5);
|
||||||
|
f3 = ff1(6);
|
||||||
|
f5 = f1 + f2 + f3;
|
||||||
|
f4 = ff1(7);
|
||||||
|
f5 = ff2(f5, f4, f5, f4);
|
||||||
|
if (f5 != 484)
|
||||||
|
chSysHalt();
|
||||||
|
chThdSleepSeconds(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPT2 callback.
|
* GPT2 callback.
|
||||||
*/
|
*/
|
||||||
static void gpt2cb(GPTDriver *gptp) {
|
static void gpt2cb(GPTDriver *gptp) {
|
||||||
/* float f1, f2, f3, f4, f5;
|
float f1, f2, f3, f4, f5;
|
||||||
|
|
||||||
(void)gptp;
|
(void)gptp;
|
||||||
|
|
||||||
|
@ -86,14 +105,14 @@ static void gpt2cb(GPTDriver *gptp) {
|
||||||
f4 = ff1(5);
|
f4 = ff1(5);
|
||||||
f5 = ff2(f5, f4, f5, f4);
|
f5 = ff2(f5, f4, f5, f4);
|
||||||
if (f5 != 196)
|
if (f5 != 196)
|
||||||
chSysHalt();*/
|
chSysHalt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPT3 callback.
|
* GPT3 callback.
|
||||||
*/
|
*/
|
||||||
static void gpt3cb(GPTDriver *gptp) {
|
static void gpt3cb(GPTDriver *gptp) {
|
||||||
/* float f1, f2, f3, f4, f5;
|
float f1, f2, f3, f4, f5;
|
||||||
|
|
||||||
(void)gptp;
|
(void)gptp;
|
||||||
|
|
||||||
|
@ -104,8 +123,7 @@ static void gpt3cb(GPTDriver *gptp) {
|
||||||
f4 = ff1(4);
|
f4 = ff1(4);
|
||||||
f5 = ff2(f5, f4, f5, f4);
|
f5 = ff2(f5, f4, f5, f4);
|
||||||
if (f5 != 100)
|
if (f5 != 100)
|
||||||
chSysHalt();*/
|
chSysHalt();
|
||||||
volatile float f1 = ff1(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -185,14 +203,12 @@ int main(void) {
|
||||||
gptStart(&GPTD3, &gpt3cfg);
|
gptStart(&GPTD3, &gpt3cfg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the mailboxes and creates the worker threads.
|
* Initializes the worker threads.
|
||||||
*/
|
*/
|
||||||
/* for (i = 0; i < NUM_THREADS; i++) {
|
chThdCreateStatic(waWorkerThread, sizeof waWorkerThread,
|
||||||
chThdCreateStatic(waWorkerThread[i], sizeof waWorkerThread[i],
|
NORMALPRIO - 20, WorkerThread, NULL);
|
||||||
NORMALPRIO - 20, WorkerThread, (void *)i);
|
chThdCreateStatic(waPeriodicThread, sizeof waPeriodicThread,
|
||||||
}*/
|
NORMALPRIO - 10, PeriodicThread, NULL);
|
||||||
chThdCreateStatic(waWorkerThread[0], sizeof waWorkerThread[0],
|
|
||||||
NORMALPRIO - 20, WorkerThread, (void *)0);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test procedure.
|
* Test procedure.
|
||||||
|
@ -236,9 +252,6 @@ int main(void) {
|
||||||
print("*** Randomize: ");
|
print("*** Randomize: ");
|
||||||
printn(RANDOMIZE);
|
printn(RANDOMIZE);
|
||||||
println("");
|
println("");
|
||||||
print("*** Threads: ");
|
|
||||||
printn(NUM_THREADS);
|
|
||||||
println("");
|
|
||||||
|
|
||||||
println("");
|
println("");
|
||||||
worst = 0;
|
worst = 0;
|
||||||
|
|
Loading…
Reference in New Issue