summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Makefile2
-rw-r--r--arch/arm/lpc17xx/ldscript2
-rw-r--r--arch/arm/lpc17xx/setjmp.s33
-rw-r--r--arch/arm/lpc17xx/specs184
-rw-r--r--arch/arm/lpc17xx/startup.s4
-rw-r--r--arch/config.mk1
6 files changed, 223 insertions, 3 deletions
diff --git a/arch/Makefile b/arch/Makefile
index e8fcf20..e32a3ab 100644
--- a/arch/Makefile
+++ b/arch/Makefile
@@ -6,6 +6,7 @@ include $(ROOTDIR)/common.mk
include config.mk
include $(ROOTDIR)/FreeRTOS/config.mk
include $(ROOTDIR)/os/config.mk
+include $(ROOTDIR)/libc/config.mk
ifeq ($(CPU),arm)
TARGET_SRCS += arm/src/angel.s
@@ -13,6 +14,7 @@ ifeq ($(CPU_FLAVOR),lpc1768)
TARGET_SRCS += arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx/system_LPC17xx.c arm/lpc17xx/Core/CM3/CoreSupport/core_cm3.c
TARGET_SRCS += $(addprefix arm/lpc17xx/Drivers/source/lpc17xx_, spi.c rit.c exti.c wdt.c uart.c dac.c rtc.c i2s.c pwm.c mcpwm.c pinsel.c nvic.c emac.c systick.c ssp.c can.c gpio.c libcfg_default.c i2c.c timer.c gpdma.c clkpwr.c qei.c adc.c)
TARGET_SRCS += arm/lpc17xx/startup.s arm/lpc17xx/deinit-all.c arm/lpc17xx/handlers.c arm/lpc17xx/Drivers/source/debug_frmwrk.c arm/lpc17xx/mbed/BoardConsole.c arm/lpc17xx/mbed/BoardInit.c
+TARGET_SRCS += arm/lpc17xx/setjmp.s
endif
endif
diff --git a/arch/arm/lpc17xx/ldscript b/arch/arm/lpc17xx/ldscript
index b8ca0b7..3962f02 100644
--- a/arch/arm/lpc17xx/ldscript
+++ b/arch/arm/lpc17xx/ldscript
@@ -18,7 +18,7 @@
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
/*ENTRY(_start)*/
SEARCH_DIR(.)
-GROUP(-lgcc -lc)
+GROUP(-lgcc)
MEMORY
{
diff --git a/arch/arm/lpc17xx/setjmp.s b/arch/arm/lpc17xx/setjmp.s
new file mode 100644
index 0000000..9ffffc2
--- /dev/null
+++ b/arch/arm/lpc17xx/setjmp.s
@@ -0,0 +1,33 @@
+.cpu cortex-m3
+.syntax unified
+
+.section ".text.setjmp","x",%progbits
+.align 2
+.thumb
+.thumb_func
+.globl setjmp
+.type setjmp, %function
+setjmp:
+.fnstart
+ mov ip, sp
+ stmea a1!, {v1-v7, fp, ip, lr}
+ mov a1, #0
+ bx lr
+.fnend
+.size setjmp,.-setjmp
+
+.section ".text.longjmp","x",%progbits
+.align 2
+.thumb
+.thumb_func
+.globl longjmp
+.type longjmp, %function
+longjmp:
+.fnstart
+ ldmfd a1!, {v1-v7, fp, ip, lr}
+ mov sp, ip
+ movs a1, a2
+ it eq
+ moveq a1, #1
+.fnend
+.size longjmp,.-longjmp
diff --git a/arch/arm/lpc17xx/specs b/arch/arm/lpc17xx/specs
new file mode 100644
index 0000000..1435a6b
--- /dev/null
+++ b/arch/arm/lpc17xx/specs
@@ -0,0 +1,184 @@
+*asm:
+%{mbig-endian:-EB} %{mlittle-endian:-EL} %{mcpu=*:-mcpu=%*} %{march=*:-march=%*} %{mapcs-*:-mapcs-%*} %(subtarget_asm_float_spec) %{mthumb-interwork:-mthumb-interwork} %{msoft-float:-mfloat-abi=soft} %{mhard-float:-mfloat-abi=hard} %{mfloat-abi=*} %{mfpu=*} %(subtarget_extra_asm_spec)
+
+*asm_debug:
+%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}} %{fdebug-prefix-map=*:--debug-prefix-map %*}
+
+*asm_final:
+
+
+*asm_options:
+%{--target-help:%:print-asm-header()} %{v} %{w:-W} %{I*} %a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}
+
+*invoke_as:
+%{!fwpa: %{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()} %{!S:-o %|.s |
+ as %(asm_options) %m.s %A } }
+
+*cpp:
+%(subtarget_cpp_spec) %{msoft-float:%{mhard-float: %e-msoft-float and -mhard_float may not be used together}} %{mbig-endian:%{mlittle-endian: %e-mbig-endian and -mlittle-endian may not be used together}}
+
+*cpp_options:
+%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps*:-fpch-preprocess}
+
+*cpp_debug_options:
+%{d*}
+
+*cpp_unique_options:
+%{C|CC:%{!E:%eGCC does not support -C or -CC without -E}} %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}} %{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{fmudflap:-D_MUDFLAP -include mf-runtime.h} %{fmudflapth:-D_MUDFLAP -D_MUDFLAPTH -include mf-runtime.h} %{E|M|MM:%W{o*}}
+
+*trad_capable_cpp:
+cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}
+
+*cc1:
+%{mandroid: %(cc1_android) ; : %(cc1_default)}
+
+*cc1_options:
+%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{a*} %{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} %{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}}%{!c:%{!S:-auxbase %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{--help=*:--help=%(VALUE)} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants} %{coverage:-fprofile-arcs -ftest-coverage}
+
+*cc1plus:
+%{mandroid: %(cc1plus_android) ; : %(cc1plus_default)}
+
+*link_gcc_c_sequence:
+--start-group %G %L --end-group
+
+*link_ssp:
+%{fstack-protector|fstack-protector-all:-lssp_nonshared -lssp}
+
+*endfile:
+%{mandroid: %(endfile_android) ; : %(endfile_default)}
+
+*link:
+%{mandroid: %(link_android) ; : %(link_default)}
+
+*lib:
+%{mandroid: %(lib_android) ; : %(lib_default)}
+
+*mfwrap:
+ %{static: %{fmudflap|fmudflapth: --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc --wrap=mmap --wrap=munmap --wrap=alloca} %{fmudflapth: --wrap=pthread_create}} %{fmudflap|fmudflapth: --wrap=main}
+
+*mflib:
+%{fmudflap|fmudflapth: -export-dynamic}
+
+*link_gomp:
+
+
+*libgcc:
+-lgcc
+
+*startfile:
+%{mandroid: %(startfile_android) ; : %(startfile_default)}
+
+*switches_need_spaces:
+o
+
+*cross_compile:
+1
+
+*version:
+4.5.2
+
+*multilib:
+. !marm !mthumb !mfloat-abi=hard;arm marm !mthumb !mfloat-abi=hard;thumb !marm mthumb !mfloat-abi=hard;fpu !marm !mthumb mfloat-abi=hard;arm/fpu marm !mthumb mfloat-abi=hard;
+
+*multilib_defaults:
+marm mlittle-endian msoft-float mno-thumb-interwork fno-leading-underscore
+
+*multilib_extra:
+
+
+*multilib_matches:
+marm marm;mthumb mthumb;mfloat-abi=hard mfloat-abi=hard;
+
+*multilib_exclusions:
+
+
+*multilib_options:
+marm/mthumb mfloat-abi=hard
+
+*linker:
+collect2
+
+*linker_plugin_file:
+
+
+*lto_wrapper:
+
+
+*lto_gcc:
+
+
+*lto_libgcc:
+
+
+*link_libgcc:
+%D
+
+*md_exec_prefix:
+
+
+*md_startfile_prefix:
+
+
+*md_startfile_prefix_1:
+
+
+*startfile_prefix_spec:
+
+
+*sysroot_spec:
+--sysroot=%R
+
+*sysroot_suffix_spec:
+
+
+*sysroot_hdrs_suffix_spec:
+
+
+*subtarget_cpp_spec:
+-D__USES_INITFINI__
+
+*subtarget_extra_asm_spec:
+%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5} %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4:--fix-v4bx}
+
+*subtarget_asm_float_spec:
+%{mapcs-float:-mfloat}
+
+*link_android:
+%{mbig-endian:-EB} %{mlittle-endian:-EL} %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} %{!static:%{shared: -Bsymbolic} %{!shared:%{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /system/bin/linker}}} -X
+
+*link_default:
+%{mbig-endian:-EB} %{mlittle-endian:-EL} %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} -X %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4:--fix-v4bx} %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}
+
+*cc1_android:
+%{!fexceptions:-fno-exceptions}
+
+*cc1_default:
+
+
+*cc1plus_android:
+%{!frtti:-fno-rtti}
+
+*cc1plus_default:
+
+
+*lib_android:
+-lc %{!static:-ldl}
+
+*lib_default:
+%{!shared:%{g*:} %{!p:%{!pg:}}%{p:}%{pg:}}
+
+*startfile_android:
+%{!shared:%{static: crtbegin_static%O%s ; : crtbegin_dynamic%O%s}}
+
+*startfile_default:
+ crti%O%s crtbegin%O%s
+
+*endfile_android:
+%{!shared:crtend_android%O%s}
+
+*endfile_default:
+crtend%O%s crtn%O%s
+
+*link_command:
+%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{fuse-linker-plugin: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=%(lto_gcc) %{static|static-libgcc:-plugin-opt=-pass-through=%(lto_libgcc)} %{static:-plugin-opt=-pass-through=-lc} %{O*:-plugin-opt=-O%*} %{w:-plugin-opt=-w} %{f*:-plugin-opt=-f%*} %{m*:-plugin-opt=-m%*} %{v:-plugin-opt=-v} } %{flto} %{fwhopr} %l %{pie:-pie} %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{Wno-poison-system-directories:--no-poison-system-directories} %{Werror=poison-system-directories:--error-poison-system-directories} %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib) %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}
+
diff --git a/arch/arm/lpc17xx/startup.s b/arch/arm/lpc17xx/startup.s
index 564c4d7..3a99753 100644
--- a/arch/arm/lpc17xx/startup.s
+++ b/arch/arm/lpc17xx/startup.s
@@ -189,12 +189,12 @@ __cs3_reset_cortex_m:
MOV R1, R3
MOV R0, R2
MOV R2, R4
- BL memcpy
+ BL startup_memcpy
LDR R0, =__bss_ram_begin
MOV R1, #0
LDR R2, =__bss_ram_len
- BL memset
+ BL startup_memset
BL lpc17xx_deinit_all
BL SystemInit
diff --git a/arch/config.mk b/arch/config.mk
index 94ea88e..caab7f3 100644
--- a/arch/config.mk
+++ b/arch/config.mk
@@ -3,5 +3,6 @@ TARGET_INCLUDES += $(ROOTDIR)/arch/arm/include
ifeq ($(CPU_FLAVOR),lpc1768)
TARGET_INCLUDES += $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/CoreSupport $(ROOTDIR)/arch/arm/lpc17xx/Drivers/include $(ROOTDIR)/arch/arm/lpc17xx/mbed
LDSCRIPT = $(ROOTDIR)/arch/arm/lpc17xx/ldscript
+SPECS = $(ROOTDIR)/arch/arm/lpc17xx/specs
endif
endif