From f43dbdc61b885a617a0e8d73bf565e48ee4d96ba Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 12 Mar 2009 18:46:53 +0000 Subject: Cortex-M3 optimization. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@834 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- docs/reports/STM32F103-72.txt | 49 +++++++++++++++++++++++-------------------- ports/ARMCM3/chcore.c | 13 ------------ ports/ARMCM3/chcore.h | 5 ++--- readme.txt | 2 ++ 4 files changed, 30 insertions(+), 39 deletions(-) diff --git a/docs/reports/STM32F103-72.txt b/docs/reports/STM32F103-72.txt index 7af64a3d4..b8e323b18 100644 --- a/docs/reports/STM32F103-72.txt +++ b/docs/reports/STM32F103-72.txt @@ -27,71 +27,74 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states) --- Test Case 3.3 (Mutexes, priority inheritance, complex case) --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 4.1 (CondVar, signal test) +--- Test Case 3.4 (CondVar, signal test) --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 4.2 (CondVar, broadcast test) +--- Test Case 3.5 (CondVar, broadcast test) --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 5.1 (Messages, dispatch test) +--- Test Case 3.6 (CondVar, inheritance boost test) --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 6.1 (Mailboxes, queuing and timeouts) +--- Test Case 4.1 (Messages, dispatch test) --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 7.1 (Events, wait and broadcast) +--- Test Case 5.1 (Mailboxes, queuing and timeouts) --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 8.1 (Heap, allocation and fragmentation test) ---- Size : 17220 bytes, not fragmented +--- Test Case 6.1 (Events, wait and broadcast) --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 9.1 (Memory Pools, allocation and enqueuing test) +--- Test Case 7.1 (Heap, allocation and fragmentation test) +--- Size : 17236 bytes, not fragmented --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 10.1 (Dynamic APIs, threads creation from heap) +--- Test Case 8.1 (Memory Pools, allocation and enqueuing test) --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 10.2 (Dynamic APIs, threads creation from memory pool) +--- Test Case 9.1 (Dynamic APIs, threads creation from heap) --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.1 (Benchmark, context switch #1, optimal) +--- Test Case 9.2 (Dynamic APIs, threads creation from memory pool) +--- Result: SUCCESS +--------------------------------------------------------------------------- +--- Test Case 10.1 (Benchmark, context switch #1, optimal) --- Score : 216992 msgs/S, 433984 ctxswc/S --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.2 (Benchmark, context switch #2, empty ready list) ---- Score : 178664 msgs/S, 357328 ctxswc/S +--- Test Case 10.2 (Benchmark, context switch #2, empty ready list) +--- Score : 178663 msgs/S, 357326 ctxswc/S --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.3 (Benchmark, context switch #3, 4 threads in ready list) +--- Test Case 10.3 (Benchmark, context switch #3, 4 threads in ready list) --- Score : 178663 msgs/S, 357326 ctxswc/S --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.4 (Benchmark, threads creation/termination, worst case) ---- Score : 164735 threads/S +--- Test Case 10.4 (Benchmark, threads creation/termination, worst case) +--- Score : 168598 threads/S --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.5 (Benchmark, threads creation/termination, optimal) ---- Score : 210633 threads/S +--- Test Case 10.5 (Benchmark, threads creation/termination, optimal) +--- Score : 216994 threads/S --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.6 (Benchmark, mass reschedulation, 5 threads) +--- Test Case 10.6 (Benchmark, mass reschedulation, 5 threads) --- Score : 55551 reschedulations/S, 333306 ctxswc/S --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.7 (Benchmark, I/O Queues throughput) +--- Test Case 10.7 (Benchmark, I/O Queues throughput) --- Score : 489472 bytes/S --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.8 (Benchmark, virtual timers set/reset) +--- Test Case 10.8 (Benchmark, virtual timers set/reset) --- Score : 647110 timers/S --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.9 (Benchmark, semaphores wait/signal) +--- Test Case 10.9 (Benchmark, semaphores wait/signal) --- Score : 823324 wait+signal/S --- Result: SUCCESS --------------------------------------------------------------------------- ---- Test Case 11.10 (Benchmark, mutexes lock/unlock) +--- Test Case 10.10 (Benchmark, mutexes lock/unlock) --- Score : 601124 lock+unlock/S --- Result: SUCCESS --------------------------------------------------------------------------- diff --git a/ports/ARMCM3/chcore.c b/ports/ARMCM3/chcore.c index 4c23b2da4..b075ec27c 100644 --- a/ports/ARMCM3/chcore.c +++ b/ports/ARMCM3/chcore.c @@ -42,19 +42,6 @@ void port_halt(void) { } } -/** - * Start a thread by invoking its work function. - * If the work function returns @p chThdExit() is automatically invoked. - */ -/** @cond never */ -__attribute__((naked, weak)) -/** @endcond */ -void threadstart(void) { - - asm volatile ("blx r1 \n\t" \ - "bl chThdExit"); -} - /** * System Timer vector. * This interrupt is used as system tick. diff --git a/ports/ARMCM3/chcore.h b/ports/ARMCM3/chcore.h index dd810df36..477e2fede 100644 --- a/ports/ARMCM3/chcore.h +++ b/ports/ARMCM3/chcore.h @@ -155,8 +155,8 @@ struct context { tp->p_ctx.r13->basepri = BASEPRI_USER; \ tp->p_ctx.r13->lr_exc = (regarm_t)0xFFFFFFFD; \ tp->p_ctx.r13->r0 = arg; \ - tp->p_ctx.r13->r1 = pf; \ - tp->p_ctx.r13->pc = threadstart; \ + tp->p_ctx.r13->lr_thd = chThdExit; \ + tp->p_ctx.r13->pc = pf; \ tp->p_ctx.r13->xpsr = (regarm_t)0x01000000; \ } @@ -303,7 +303,6 @@ struct context { extern "C" { #endif void port_halt(void); - void threadstart(void); #ifdef __cplusplus } #endif diff --git a/readme.txt b/readme.txt index 119377d3c..808dac082 100644 --- a/readme.txt +++ b/readme.txt @@ -87,6 +87,8 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process, the macro chSysGetTime() in chTimeNow(), the old names are still recognized but marked as deprecated (fixes the bug 2678953 but goes a bit further by introducing a new API category "Time"). +- OPT: Small optimization to the Cortex-M3 port code, improved thread + related performance scores and smaller code. - Removed testcond.c|h and moved the test cases into testmtx.c. Mutexes and condvars have to be tested together. - Added architecture diagram to the documentation. -- cgit v1.2.3