From 0f434c4a9574b8d6d74c4fa5c1d4f6914542f3de Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 27 Nov 2012 20:20:15 +0100 Subject: [PATCH] Initialize the stack pointer to allow rPi to jump into C. The stack pointer is set up so that it uses the space below our .text section at 0x8000. The stack pointer actually points at one entry less than the specified address, so it starts at 0x8000 - sizeof(uint32) and grows downwards from there. --- src/system/boot/platform/raspberrypi_arm/entry.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/system/boot/platform/raspberrypi_arm/entry.S b/src/system/boot/platform/raspberrypi_arm/entry.S index d49b20a51a..c088b9b1c2 100644 --- a/src/system/boot/platform/raspberrypi_arm/entry.S +++ b/src/system/boot/platform/raspberrypi_arm/entry.S @@ -19,6 +19,10 @@ jmp_loader: bx r12 */ + /* Setup initial stack right below our .text section (growing downwards + into the space reserved for .init) */ + mov sp, #0x8000 + b _start /* Cause exception if loader returns */