Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
@@ -3,7 +3,7 @@ CC = $(CROSS)gcc
OBJCOPY = $(CROSS)objcopy
ICEPROG = iceprog
-CFLAGS=-Wall -Os -march=rv32i -mabi=ilp32 -ffreestanding -nostartfiles
+CFLAGS=-Wall -Os -march=rv32i -mabi=ilp32 -ffreestanding -flto -nostartfiles -fomit-frame-pointer -Wl,--gc-section
HEADERS=\
mini-printf.h \
@@ -22,9 +22,9 @@
#define FLASH_APP_ADDR 0x00100000
#endif
- .section .text
-
-start:
+ .section .text.start
+ .global _start
+_start:
#ifdef BOOT_DEBUG
// Set UART divisor
@@ -4,10 +4,12 @@ MEMORY
SPRAM (xrw) : ORIGIN = 0x0001c000, LENGTH = 0x4000
BRAM (xrw) : ORIGIN = 0x00000010, LENGTH = 0x03f0
}
+ENTRY(_start)
SECTIONS {
.text :
{
. = ALIGN(4);
+ *(.text.start)
*(.text)
*(.text*)
*(.rodata)
@@ -2,10 +2,12 @@ MEMORY
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x0400
} >ROM
@@ -19,9 +19,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
// zero-initialize register file
addi x1, zero, 0