diff --git a/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/vector_functions.s b/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/vector_functions.s index 6e99ec8e08..a3803a0f2b 100644 --- a/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/vector_functions.s +++ b/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/vector_functions.s @@ -77,7 +77,6 @@ __mbed_dcc_irq: Reset_Handler: .extern __libc_init_array .extern SystemInit - .extern __wrap_main LDR R0, =SystemInit MOV LR, PC BX R0 @@ -86,7 +85,7 @@ Reset_Handler: MOV LR, PC BX R0 - LDR R0, =__wrap_main + LDR R0, =main BX R0 __mbed_reset: diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/serial_api.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/serial_api.c index 1e0faf79b0..18af9ce64c 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/serial_api.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/serial_api.c @@ -225,7 +225,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b stop_bits -= 1; data_bits -= 5; - int parity_enable, parity_select; + int parity_enable = 0, parity_select = 0; switch (parity) { case ParityNone: parity_enable = 0; parity_select = 0; break; case ParityOdd : parity_enable = 1; parity_select = 0; break; diff --git a/workspace_tools/export/gcc_arm_lpc2368.tmpl b/workspace_tools/export/gcc_arm_lpc2368.tmpl new file mode 100644 index 0000000000..aeecf7839b --- /dev/null +++ b/workspace_tools/export/gcc_arm_lpc2368.tmpl @@ -0,0 +1,71 @@ +# This file was automagically generated by mbed.org. For more information, +# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded + +GCC_BIN = +PROJECT = {{name}} +OBJECTS = {% for f in to_be_compiled %}{{f}} {% endfor %} +SYS_OBJECTS = {% for f in object_files %}{{f}} {% endfor %} +INCLUDE_PATHS = {% for p in include_paths %}-I{{p}} {% endfor %} +LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %} +LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %} +LINKER_SCRIPT = {{linker_script}} + +############################################################################### +AS = $(GCC_BIN)arm-none-eabi-as +CC = $(GCC_BIN)arm-none-eabi-gcc +CPP = $(GCC_BIN)arm-none-eabi-g++ +LD = $(GCC_BIN)arm-none-eabi-gcc +OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy +OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump +SIZE = $(GCC_BIN)arm-none-eabi-size + +CPU = -mcpu=arm7tdmi-s +CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections +CC_FLAGS += -MMD -MP +CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %} + +LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float +LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref -Wl,--entry=_start +LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys + +ifeq ($(DEBUG), 1) + CC_FLAGS += -DDEBUG -O0 +else + CC_FLAGS += -DNDEBUG -Os +endif + +all: $(PROJECT).bin $(PROJECT).hex size + +clean: + rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS) $(DEPS) + +.s.o: + $(AS) $(CPU) -o $@ $< + +.c.o: + $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $< + +.cpp.o: + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< + + +$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) + $(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS) + +$(PROJECT).bin: $(PROJECT).elf + @$(OBJCOPY) -O binary $< $@ + +$(PROJECT).hex: $(PROJECT).elf + @$(OBJCOPY) -O ihex $< $@ + +$(PROJECT).lst: $(PROJECT).elf + @$(OBJDUMP) -dh $< > $@ + +lst: $(PROJECT).lst + +size: + $(SIZE) $(PROJECT).elf + +DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d) +-include $(DEPS) + diff --git a/workspace_tools/export/gccarm.py b/workspace_tools/export/gccarm.py index c9d009c649..e7f58214ae 100644 --- a/workspace_tools/export/gccarm.py +++ b/workspace_tools/export/gccarm.py @@ -42,6 +42,7 @@ class GccArm(Exporter): 'UBLOX_C027', 'ARCH_PRO', 'NRF51822', + 'LPC2368', ] DOT_IN_RELATIVE_PATH = True diff --git a/workspace_tools/export_test.py b/workspace_tools/export_test.py index 4d39b2118a..7749511393 100644 --- a/workspace_tools/export_test.py +++ b/workspace_tools/export_test.py @@ -99,6 +99,7 @@ if __name__ == '__main__': ('gcc_arm', 'LPC1114'), ('gcc_arm', 'LPC11U35_401'), ('gcc_arm', 'LPC11U35_501'), + ('gcc_arm', 'LPC2368'), ('gcc_arm', 'STM32F407'), ('gcc_arm', 'DISCO_F100RB'), diff --git a/workspace_tools/toolchains/gcc.py b/workspace_tools/toolchains/gcc.py index a14f1a1503..ae90edae53 100644 --- a/workspace_tools/toolchains/gcc.py +++ b/workspace_tools/toolchains/gcc.py @@ -173,7 +173,7 @@ class GCC_ARM(GCC): # Use latest gcc nanolib self.ld.append("--specs=nano.specs") - if target.name in ["LPC1768", "LPC4088", "LPC4330", "UBLOX_C027"]: + if target.name in ["LPC1768", "LPC4088", "LPC4330", "UBLOX_C027", "LPC2368"]: self.ld.extend(["-u", "_printf_float", "-u", "_scanf_float"]) self.sys_libs.append("nosys")