projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
First version of new i2c bitbang API.
[bertos.git]
/
bertos
/
cpu
/
cortex-m3
/
hw
/
crt_cm3.S
diff --git
a/bertos/cpu/cortex-m3/hw/crt_cm3.S
b/bertos/cpu/cortex-m3/hw/crt_cm3.S
index a442bc59e0a07c12a665136c4778870140ecb5a6..c23d83741c0ee16421a682da411a33adde718386 100644
(file)
--- a/
bertos/cpu/cortex-m3/hw/crt_cm3.S
+++ b/
bertos/cpu/cortex-m3/hw/crt_cm3.S
@@
-35,6
+35,9
@@
* \author Andrea Righi <arighi@develer.com>
*/
* \author Andrea Righi <arighi@develer.com>
*/
+#define CONTROL_UNPRIVILEGED 1
+#define CONTROL_PSP 2
+
.syntax unified
.thumb
.section .init, "ax", %progbits
.syntax unified
.thumb
.section .init, "ax", %progbits
@@
-61,6
+64,11
@@
__dummy_init:
__init0:
/* Disable IRQs */
cpsid i
__init0:
/* Disable IRQs */
cpsid i
+ /*
+ * Initialize process stack pointer.
+ */
+ ldr r0, =__psp_end
+ msr psp, r0
/* Call the early hardware initialization routine */
bl __init1
/* Call the early hardware initialization routine */
bl __init1
@@
-86,10
+94,18
@@
bss_loop:
strlo r0, [r1], #4
blo bss_loop
strlo r0, [r1], #4
blo bss_loop
+ /* Switch to the process stack */
+ movs r0, CONTROL_PSP
+ msr control, r0
+ isb
+
/* Call the hardware initialization routine */
bl __init2
/* Call the application's entry point */
/* Call the hardware initialization routine */
bl __init2
/* Call the application's entry point */
+ cpsie i
+ mov r0, #0
+ mov r1, #0
bl main
end:
wfi
bl main
end:
wfi