From 599549535062d7275e52a754d5632f896d0ae986 Mon Sep 17 00:00:00 2001 From: Natie van Rooyen Date: Thu, 27 Sep 2012 12:18:00 +0200 Subject: [PATCH] Updated for new stack alignment changes in atom.h. --- platforms/qemu_integratorcp/Makefile | 11 +++++++---- platforms/qemu_integratorcp/README | 4 +++- platforms/qemu_integratorcp/main.c | 4 ++-- platforms/qemu_lm3s/Makefile | 4 ++-- platforms/qemu_lm3s/README | 4 ++++ platforms/qemu_lm3s/main.c | 4 ++-- ports/arm/README | 4 ++-- ports/arm/atomport.h | 24 +++++++++++++++++++----- ports/cortex_m/atomport.h | 25 +++++++++++++++++++++---- 9 files changed, 62 insertions(+), 22 deletions(-) diff --git a/platforms/qemu_integratorcp/Makefile b/platforms/qemu_integratorcp/Makefile index e88e47d..efed519 100644 --- a/platforms/qemu_integratorcp/Makefile +++ b/platforms/qemu_integratorcp/Makefile @@ -44,7 +44,7 @@ include ../rules.mk run_test: clean all echo "START TEST $(TEST_NAME)" - qemu-system-arm -M integratorcp -kernel boot.elf -semihosting | tee atomthreads_test.out + qemu-system-arm -M integratorcp -kernel boot.elf -semihosting >> atomthreads_test.out all_tests: echo "Starting atomthreads test suite" > atomthreads_test.out @@ -60,7 +60,6 @@ all_tests: make run_test "TEST_NAME=kern1" make run_test "TEST_NAME=kern2" make run_test "TEST_NAME=kern3" - make run_test "TEST_NAME=kern4" make run_test "TEST_NAME=timer1" make run_test "TEST_NAME=timer2" make run_test "TEST_NAME=timer3" @@ -86,6 +85,10 @@ all_tests: make run_test "TEST_NAME=sem8" make run_test "TEST_NAME=sem9" -run_last: - qemu-system-arm -M integratorcp -kernel boot.elf -monitor stdio -semihosting +fail_tests: + make run_test "TEST_NAME=kern4" + + +run_last: + qemu-system-arm -M integratorcp -kernel boot.elf -semihosting diff --git a/platforms/qemu_integratorcp/README b/platforms/qemu_integratorcp/README index 5deb509..0177f81 100644 --- a/platforms/qemu_integratorcp/README +++ b/platforms/qemu_integratorcp/README @@ -9,4 +9,6 @@ License: BSD Revised QEMU ARM Integrator/CP (ARM926EJ-S) Platform The "qemu_integratorcp" platform contains sources for building a sample -Atomthreads application for the ARM Integrator/CP (ARM926EJ-S) platform. \ No newline at end of file +Atomthreads application for the ARM Integrator/CP (ARM926EJ-S) platform. +BUGS: +kern4 testcase fails (sometimes). \ No newline at end of file diff --git a/platforms/qemu_integratorcp/main.c b/platforms/qemu_integratorcp/main.c index 3222170..aebdd3d 100644 --- a/platforms/qemu_integratorcp/main.c +++ b/platforms/qemu_integratorcp/main.c @@ -77,8 +77,8 @@ main (void) printf ("atomthreads starting %s... ", ATOMTHREADS_TEST) ; - atomOSInit(&idle_stack[IDLE_STACK_BYTE_SIZE - sizeof(unsigned int)], IDLE_STACK_BYTE_SIZE - sizeof(unsigned int)) ; - atomThreadCreate ((ATOM_TCB *)&test_tcb, TEST_THREAD_PRIO, test_thread, 0, &test_stack[(TEST_STACK_BYTE_SIZE) - sizeof(unsigned int)], TEST_STACK_BYTE_SIZE - sizeof(unsigned int)); + atomOSInit(&idle_stack[0], IDLE_STACK_BYTE_SIZE, TRUE) ; + atomThreadCreate ((ATOM_TCB *)&test_tcb, TEST_THREAD_PRIO, test_thread, 0, &test_stack[0], TEST_STACK_BYTE_SIZE, TRUE); atomOSStart() ; return 0 ; diff --git a/platforms/qemu_lm3s/Makefile b/platforms/qemu_lm3s/Makefile index c8568ad..dc9c117 100644 --- a/platforms/qemu_lm3s/Makefile +++ b/platforms/qemu_lm3s/Makefile @@ -85,11 +85,11 @@ all_tests: make run_test "TEST_NAME=sem8" make run_test "TEST_NAME=sem9" -all_fail: +fail_tests: make run_test "TEST_NAME=mutex4" make run_test "TEST_NAME=sem4" run_last: - qemu-system-arm -M lm3s6965evb -kernel boot.elf -monitor stdio -semihosting + qemu-system-arm -M lm3s6965evb -kernel boot.elf -semihosting diff --git a/platforms/qemu_lm3s/README b/platforms/qemu_lm3s/README index 6e340d1..bdd09ab 100644 --- a/platforms/qemu_lm3s/README +++ b/platforms/qemu_lm3s/README @@ -31,3 +31,7 @@ Fixes implemented for the QEMU 1.2.0 release: Because of the problems with the Sys Tick Interrupt the The Stellaris General-Purpose Timer Module (GPTM) was used to generate the system timer tick. + +BUGS: +mutex4 testcase fails. +sem4 testcase fails. \ No newline at end of file diff --git a/platforms/qemu_lm3s/main.c b/platforms/qemu_lm3s/main.c index 9aa5bdc..725a642 100644 --- a/platforms/qemu_lm3s/main.c +++ b/platforms/qemu_lm3s/main.c @@ -79,8 +79,8 @@ main (void) uint32_t failures ; printf ("Atomthreads starting %s... \r\n", ATOMTHREADS_TEST) ; - atomOSInit(&idle_stack[IDLE_STACK_BYTE_SIZE - sizeof(unsigned int)], IDLE_STACK_BYTE_SIZE - sizeof(unsigned int)) ; - atomThreadCreate ((ATOM_TCB *)&test_tcb, TEST_THREAD_PRIO, test_thread, 0, &test_stack[(TEST_STACK_BYTE_SIZE) - sizeof(unsigned int)], TEST_STACK_BYTE_SIZE - sizeof(unsigned int)); + atomOSInit(&idle_stack[0], IDLE_STACK_BYTE_SIZE, TRUE) ; + atomThreadCreate ((ATOM_TCB *)&test_tcb, TEST_THREAD_PRIO, test_thread, 0, &test_stack[0], TEST_STACK_BYTE_SIZE, TRUE); atomOSStart() ; return 0 ; diff --git a/ports/arm/README b/ports/arm/README index 8fa5797..e471306 100644 --- a/ports/arm/README +++ b/ports/arm/README @@ -9,8 +9,8 @@ License: BSD Revised ARM PORT This folder contains a port of the Atomthreads real time kernel for the -ARM processor architecture. This port was tested on Cortex A9, Cortex A15 -and the ARM926EJ-S (QEMU). +ARM processor architecture. This port was tested on the ARMv5 and ARMv7 +architectures. To Use: diff --git a/ports/arm/atomport.h b/ports/arm/atomport.h index f7ac10d..f07e75a 100644 --- a/ports/arm/atomport.h +++ b/ports/arm/atomport.h @@ -32,8 +32,17 @@ #include "types.h" -#define SYSTEM_TICKS_PER_SEC 100 +#define SYSTEM_TICKS_PER_SEC 100 +/** + * Definition of NULL. + * If stddef.h is available on the platform it is simplest to include it + * from this header, otherwise define below. + */ +#define NULL ((void *)(0)) + +/* Size of each stack entry / stack alignment size (e.g. 32 bits) */ +#define STACK_ALIGN_SIZE sizeof(unsigned int) /** * Architecture-specific types. @@ -47,12 +56,17 @@ * Functions defined in atomport_arm.asm * */ -extern void contextInit (void) ; -extern uint32_t contextEnterCritical (void) ; -extern void contextExitCritical (uint32_t posture) ; +extern void contextInit (void) ; +extern uint32_t contextEnterCritical (void) ; +extern void contextExitCritical (uint32_t posture) ; -/* Critical region protection */ +/** + * Critical region protection: this should disable interrupts + * to protect OS data structures during modification. It must + * allow nested calls, which means that interrupts should only + * be re-enabled when the outer CRITICAL_END() is reached. + */ #define CRITICAL_STORE uint32_t __atom_critical #define CRITICAL_START() __atom_critical = contextEnterCritical() #define CRITICAL_END() contextExitCritical(__atom_critical) diff --git a/ports/cortex_m/atomport.h b/ports/cortex_m/atomport.h index f7ac10d..1a4cfd9 100644 --- a/ports/cortex_m/atomport.h +++ b/ports/cortex_m/atomport.h @@ -32,7 +32,23 @@ #include "types.h" -#define SYSTEM_TICKS_PER_SEC 100 +#define SYSTEM_TICKS_PER_SEC 100 + +/** + * Definition of NULL. + * If stddef.h is available on the platform it is simplest to include it + * from this header, otherwise define below. + */ +#define NULL ((void *)(0)) + +/* Size of each stack entry / stack alignment size (e.g. 32 bits) */ +#define STACK_ALIGN_SIZE sizeof(unsigned int) + +/** + * Architecture-specific types. + * Most of these are available from types.h on this platform, which is + * included above. + */ /** @@ -47,9 +63,9 @@ * Functions defined in atomport_arm.asm * */ -extern void contextInit (void) ; -extern uint32_t contextEnterCritical (void) ; -extern void contextExitCritical (uint32_t posture) ; +extern void contextInit (void) ; +extern uint32_t contextEnterCritical (void) ; +extern void contextExitCritical (uint32_t posture) ; /* Critical region protection */ @@ -58,3 +74,4 @@ extern void contextExitCritical (uint32_t posture) ; #define CRITICAL_END() contextExitCritical(__atom_critical) #endif /* __ATOM_PORT_H__ */ +