freemyipod r454 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r453‎ | r454 | r455 >
Date:19:30, 19 January 2011
Author:theseven
Status:new
Tags:
Comment:
helloworld: Switch to emCORE
Modified paths:
  • /apps/helloworld/Makefile (modified) (history)
  • /apps/helloworld/ls.x (modified) (history)
  • /apps/helloworld/main.c (modified) (history)

Diff [purge]

Index: apps/helloworld/ls.x
@@ -1,10 +1,10 @@
2 -ENTRY(__embios_executable_hdr)
 2+ENTRY(__emcore_entrypoint)
33 OUTPUT_FORMAT(elf32-littlearm)
44 OUTPUT_ARCH(arm)
55
66 MEMORY
77 {
8 - RAM : ORIGIN = 0x08000000, LENGTH = 0x01f00000
 8+ VIRTUAL : ORIGIN = 0x00000000, LENGTH = 0x10000000
99 }
1010
1111 SECTIONS
@@ -11,17 +11,21 @@
1212 {
1313 .text :
1414 {
15 - KEEP(.execheader*)
16 - *(.execheader*)
 15+ KEEP(.emcoreentrypoint*)
 16+ *(.emcoreentrypoint*)
1717 *(.text*)
1818 *(.glue_7)
1919 *(.glue_7t)
2020 . = ALIGN(0x4);
 21+ } > VIRTUAL
 22+
 23+ .data :
 24+ {
2125 *(.rodata*)
2226 . = ALIGN(0x4);
2327 *(.data*)
2428 . = ALIGN(0x4);
25 - } > RAM
 29+ } > VIRTUAL
2630
2731 .bss (NOLOAD) :
2832 {
@@ -29,8 +33,7 @@
3034 *(.bss*)
3135 *(COMMON)
3236 __bss_end = .;
33 - *(.stack*)
34 - } > RAM
 37+ } > VIRTUAL
3538
3639 /DISCARD/ :
3740 {
Index: apps/helloworld/main.c
@@ -1,8 +1,8 @@
2 -#include "embiosapp.h"
 2+#include "emcoreapp.h"
33
44
55 void main();
6 -EMBIOS_APP_HEADER("Test application", 0x4000, main, 127)
 6+EMCORE_APP_HEADER("Hello world", main, 127)
77
88
99 void main()
Index: apps/helloworld/Makefile
@@ -1,16 +1,18 @@
22 NAME := helloworld
 3+STACKSIZE := 4096
 4+COMPRESS := false
35
4 -EMBIOSDIR ?= ../../embios/trunk/
 6+EMCOREDIR ?= ../../emcore/trunk/
57
6 -CROSS ?= arm-none-eabi-
 8+CROSS ?= arm-elf-eabi-
79 CC := $(CROSS)gcc
810 AS := $(CROSS)as
911 LD := $(CROSS)ld
1012 OBJCOPY := $(CROSS)objcopy
11 -UCLPACK := ucl2e10singleblk
 13+ELF2ECA := $(CROSS)elf2emcoreapp
1214
13 -CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
14 -LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
 15+CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
 16+LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" -d -r --gc-sections
1517
1618 preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
1719 preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
@@ -18,7 +20,7 @@
1921 REVISION := $(shell svnversion .)
2022 REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
2123
22 -HELPERS := build/__embios_armhelpers.o
 24+HELPERS := build/__emcore_armhelpers.o
2325
2426 SRC := $(call preprocesspaths,SOURCES,-I. -I..)
2527 OBJ := $(SRC:%.c=build/%.o)
@@ -28,22 +30,22 @@
2931
3032 -include $(OBJ:%=%.dep)
3133
32 -$(NAME): build/$(NAME).embiosapp.ucl
 34+$(NAME): build/$(NAME).emcoreapp
3335
34 -build/$(NAME).embiosapp.ucl: build/$(NAME).embiosapp
35 - @echo [UCL] $<
36 - @$(UCLPACK) $^ $@
 36+build/$(NAME).emcoreapp: build/$(NAME).elf
 37+ @echo "[EMCAPP] $<"
 38+ifeq ($(COMPRESS),true)
 39+ @$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
 40+else
 41+ @$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
 42+endif
3743
38 -build/$(NAME).embiosapp: build/$(NAME).elf
39 - @echo [OC] $<
40 - @$(OBJCOPY) -O binary $^ $@
41 -
4244 build/$(NAME).elf: ls.x $(OBJ)
43 - @echo [LD] $@
 45+ @echo "[LD] $@"
4446 @$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
4547
4648 build/%.o: %.c build/version.h
47 - @echo [CC] $<
 49+ @echo "[CC] $<"
4850 ifeq ($(shell uname),WindowsNT)
4951 @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
5052 else
@@ -60,7 +62,7 @@
6163 @rm -f $@.dep.tmp
6264
6365 build/%.o: %.S build/version.h
64 - @echo [CC] $<
 66+ @echo "[CC] $<"
6567 ifeq ($(shell uname),WindowsNT)
6668 @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
6769 else
@@ -76,8 +78,8 @@
7779 endif
7880 @rm -f $@.dep.tmp
7981
80 -build/__embios_%.o: $(EMBIOSDIR)/export/%.S
81 - @echo [CC] $<
 82+build/__emcore_%.o: $(EMCOREDIR)/export/%.S
 83+ @echo "[CC] $<"
8284 ifeq ($(shell uname),WindowsNT)
8385 @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
8486 else
@@ -86,7 +88,7 @@
8789 @$(CC) -c $(CFLAGS) -o $@ $<
8890
8991 build/version.h: version.h .svn/entries build
90 - @echo [PP] $<
 92+ @echo "[PP] $<"
9193 ifeq ($(shell uname),WindowsNT)
9294 @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
9395 else