mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
galileo: Add a bootstrap stack for C runtime
All we need to provide to C at this point is a region in memory dedicated to its stack. This is done by allocating a region in .bss and pushing its start address to esp. Since the multiboot spec says it is not safe to rely on the initial stack provided by the bootloader, this patch provides our own stack. Galileo boards have 512Kb of SRAM and 256Mb of DDR3 RAM, so providing 8kb as a start seems safe. Moreover, stack sizes are very application-oriented so it may be too early to provide a bigger (or smaller) stack.
This commit is contained in:
parent
7a1898f73e
commit
595088be09
@ -28,6 +28,10 @@
|
|||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
# Kernel
|
||||||
|
.set STACK_SIZE, 8192
|
||||||
|
|
||||||
|
# Multiboot
|
||||||
.set MAGIC_NUMBER, 0x1BADB002
|
.set MAGIC_NUMBER, 0x1BADB002
|
||||||
.set FLAGS, 0x0
|
.set FLAGS, 0x0
|
||||||
.set CHECKSUM, -MAGIC_NUMBER
|
.set CHECKSUM, -MAGIC_NUMBER
|
||||||
@ -38,10 +42,14 @@
|
|||||||
.long FLAGS
|
.long FLAGS
|
||||||
.long CHECKSUM
|
.long CHECKSUM
|
||||||
|
|
||||||
|
# Reserve space for the C stack.
|
||||||
|
.lcomm c_stack, STACK_SIZE
|
||||||
|
|
||||||
.section .text
|
.section .text
|
||||||
.global start
|
.global start
|
||||||
start:
|
start:
|
||||||
cli
|
cli
|
||||||
|
movl $(c_stack + STACK_SIZE), %esp
|
||||||
call main
|
call main
|
||||||
|
|
||||||
/* We're not expected to return from main(). But if we do we halt */
|
/* We're not expected to return from main(). But if we do we halt */
|
||||||
|
Loading…
Reference in New Issue
Block a user