aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-04-12 13:56:29 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-04-12 13:56:29 +0000
commitf0c8dde933f7fee21163d9831821dc524b56e6ef (patch)
treefb685ce542876f77ac7c350cfc225ea274ed313d
parente1613c5169d7c792015d6a0bd2224626873af4e2 (diff)
downloadChibiOS-f0c8dde933f7fee21163d9831821dc524b56e6ef.tar.gz
ChibiOS-f0c8dde933f7fee21163d9831821dc524b56e6ef.tar.bz2
ChibiOS-f0c8dde933f7fee21163d9831821dc524b56e6ef.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@260 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/ARMCM3-STM32F103-GCC/board.c3
-rw-r--r--demos/ARMCM3-STM32F103-GCC/ch.ld2
-rw-r--r--demos/ARMCM3-STM32F103-GCC/main.c9
-rw-r--r--ports/ARMCM3/chcore.c8
-rw-r--r--ports/ARMCM3/chcore.h4
-rw-r--r--ports/ARMCM3/crt0.s4
-rw-r--r--ports/ARMCM3/nvic.h4
7 files changed, 16 insertions, 18 deletions
diff --git a/demos/ARMCM3-STM32F103-GCC/board.c b/demos/ARMCM3-STM32F103-GCC/board.c
index 1323030f0..283341c4f 100644
--- a/demos/ARMCM3-STM32F103-GCC/board.c
+++ b/demos/ARMCM3-STM32F103-GCC/board.c
@@ -75,7 +75,7 @@ void hwinit(void) {
GPIOD->CRL = VAL_GPIODCRL;
GPIOD->CRH = VAL_GPIODCRH;
GPIOD->ODR = VAL_GPIODODR;
-#if 0
+
/*
* NVIC/SCB initialization.
*/
@@ -88,5 +88,4 @@ void hwinit(void) {
ST_RVR = SYSCLK / (8000000 / CH_FREQUENCY) - 1;
ST_CVR = 0;
ST_CSR = ENABLE_ON_BITS | TICKINT_ENABLED_BITS | CLKSOURCE_EXT_BITS;
-#endif
}
diff --git a/demos/ARMCM3-STM32F103-GCC/ch.ld b/demos/ARMCM3-STM32F103-GCC/ch.ld
index 96c5a3a1d..d5f948476 100644
--- a/demos/ARMCM3-STM32F103-GCC/ch.ld
+++ b/demos/ARMCM3-STM32F103-GCC/ch.ld
@@ -20,7 +20,7 @@
/*
* ST32F103 memory setup.
*/
-__main_stack_size__ = 0x0100;
+__main_stack_size__ = 0x0200;
__process_stack_size__ = 0x0100;
__stacks_total_size__ = __main_stack_size__ + __process_stack_size__;
diff --git a/demos/ARMCM3-STM32F103-GCC/main.c b/demos/ARMCM3-STM32F103-GCC/main.c
index 99a1c085e..a5b766de5 100644
--- a/demos/ARMCM3-STM32F103-GCC/main.c
+++ b/demos/ARMCM3-STM32F103-GCC/main.c
@@ -28,7 +28,10 @@ static WorkingArea(waThread1, 64);
static msg_t Thread1(void *arg) {
while (TRUE) {
- chThdSleep(1000);
+ GPIOC->BRR = GPIOC_LED;
+ chThdSleep(500);
+ GPIOC->BSRR = GPIOC_LED;
+ chThdSleep(500);
}
return 0;
}
@@ -38,10 +41,6 @@ static msg_t Thread1(void *arg) {
*/
int main(int argc, char **argv) {
- GPIOC->BRR = GPIOC_LED;
- while(1)
- ;
-
/*
* The main() function becomes a thread here then the interrupts are
* enabled and ChibiOS/RT goes live.
diff --git a/ports/ARMCM3/chcore.c b/ports/ARMCM3/chcore.c
index d691cee20..5a718abc0 100644
--- a/ports/ARMCM3/chcore.c
+++ b/ports/ARMCM3/chcore.c
@@ -75,9 +75,7 @@ void threadstart(void) {
void SysTickVector(void) {
chSysIRQEnterI();
-
chSysTimerHandlerI();
-
chSysIRQExitI();
}
@@ -94,8 +92,9 @@ void chSysIRQExitI(void) {
if (chSchRescRequiredI()) {
asm volatile ("mrs r0, PSP \n\t" \
- "ldr r1, =retaddr \n\t" \
"ldr r2, [r0, #24] \n\t" \
+ "orr r2, r2, #1 \n\t" \
+ "ldr r1, =retaddr \n\t" \
"str r2, [r1] \n\t" \
"ldr r1, =threadswitch \n\t" \
"str r1, [r0, #24] ");
@@ -117,8 +116,9 @@ void threadswitch(void) {
"mrs r0, XPSR \n\t" \
"push {r0} \n\t" \
"ldr r0, =retaddr \n\t" \
+ "ldr r0, [r0] \n\t" \
"str r0, [sp, #28] \n\t" \
- "b chSchDoRescheduleI \n\t" \
+ "bl chSchDoRescheduleI \n\t" \
"pop {r0} \n\t" \
"msr XPSR, r0 \n\t" \
"pop {r0-r3, r12, lr} \n\t" \
diff --git a/ports/ARMCM3/chcore.h b/ports/ARMCM3/chcore.h
index 2810368b6..0ff988189 100644
--- a/ports/ARMCM3/chcore.h
+++ b/ports/ARMCM3/chcore.h
@@ -87,8 +87,8 @@ typedef struct {
#define chSysIRQEnterI()
-/* It requires zero bytes, but better be safe.*/
-#define IDLE_THREAD_STACK_SIZE 8
+/* It should be 8.*/
+#define IDLE_THREAD_STACK_SIZE 16
void _IdleThread(void *p) __attribute__((noreturn));
void chSysHalt(void);
diff --git a/ports/ARMCM3/crt0.s b/ports/ARMCM3/crt0.s
index 75be93753..836934c33 100644
--- a/ports/ARMCM3/crt0.s
+++ b/ports/ARMCM3/crt0.s
@@ -24,16 +24,16 @@
.set CONTROL_MODE_PRIVILEGED, 0
.set CONTROL_MODE_UNPRIVILEGED, 1
.set CONTROL_USE_MSP, 0
-.set CONTROL_USE_PSP, 0
+.set CONTROL_USE_PSP, 2
.text
.balign 2
.syntax unified
+.thumb
/*
* Reset handler.
*/
-.thumb
.thumb_func
.global ResetHandler
ResetHandler:
diff --git a/ports/ARMCM3/nvic.h b/ports/ARMCM3/nvic.h
index 62ea7317d..f7d513412 100644
--- a/ports/ARMCM3/nvic.h
+++ b/ports/ARMCM3/nvic.h
@@ -43,8 +43,8 @@ typedef struct {
#define ENABLE_OFF_BITS (0 << 0)
#define ENABLE_ON_BITS (1 << 0)
#define CSR_TICKINT_MASK (0x1 << 1)
-#define TICKINT_DISABLED_BITS (0 << 0)
-#define TICKINT_ENABLED_BITS (1 << 0)
+#define TICKINT_DISABLED_BITS (0 << 1)
+#define TICKINT_ENABLED_BITS (1 << 1)
#define CSR_CLKSOURCE_MASK (0x1 << 2)
#define CLKSOURCE_EXT_BITS (0 << 2)
#define CLKSOURCE_CORE_BITS (1 << 2)