From: Nathael Pajani Date: Tue, 27 Sep 2016 20:11:15 +0000 (+0200) Subject: Improve Makefile - Add comments - Use LDFLAGS instead of LINKOPTS - Use $(DEBUG)... X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=501c43a2b85b7a0543047cdee320bda4d96c10db;p=soft%2Flpc122x%2Fcore Improve Makefile - Add comments - Use LDFLAGS instead of LINKOPTS - Use $(DEBUG) var Fixes on Linker script - Removed info page size and offset as they are accessible only "in app" - Remove duplicate hardcoded values - Fix for recent GCC versions - Fix system_init Update Readme --- diff --git a/Makefile b/Makefile index 63412d3..2b79436 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,28 @@ -# Makefile for GPIO Demo Module +# Makefile for LPC122x micro-controller based boards TARGET_DIR = apps/$(MODULE)/$(NAME) +# If you use another of the LPC122x micro-controllers, copy the lpc_link_lpc1224.ld file +# to match you LPC micro-controller model and modify the memory sizes definitions at the +# beginning of your new file. +# Note that the LPC1224 has the smallest memory of the LPC122x branch, and thus using the +# lpc1224 linker script will work for all LPC122x, but not all memory will be available. LPC = lpc1224 CPU = cortex-m0 ARCH = armv6-m CROSS_COMPILE ?= arm-none-eabi- CC = $(CROSS_COMPILE)gcc +#DEBUG = -g +LD_DEBUG = $(DEBUG) +#LD_DEBUG = $(DEBUG) -Wl,--print-memory-usage +#LD_DEBUG = $(DEBUG) -Wl,--print-gc-sections -Wl,--print-output-format \ + -Wl,--print-memory-usage FOPTS = -fno-builtin -ffunction-sections -fdata-sections -ffreestanding -CFLAGS = -Wall -g -O2 -mthumb -mcpu=$(CPU) $(FOPTS) -LINKOPTS = -static -g -nostartfiles -nostdlib \ - -Wl,--gc-sections -Wl,--build-id=none \ - -Wl,-Map=$(TARGET_DIR)/lpc_map_$(LPC).map -Tlpc_link_$(LPC).ld +CFLAGS = -Wall -O2 $(DEBUG) -mthumb -mcpu=$(CPU) $(FOPTS) +LDFLAGS = -static $(LD_DEBUG) -nostartfiles -nostdlib -Tlpc_link_$(LPC).ld \ + -Wl,--gc-sections -Wl,--sort-section=alignment -Wl,--build-id=none \ + -Wl,-Map=$(TARGET_DIR)/lpc_map_$(LPC).map APPS = $(subst apps/,,$(wildcard apps/*/*)) @@ -40,7 +50,7 @@ NAME_DEPS = ${NAME_OBJS:%.o=$(OBJDIR)/%.d} .PRECIOUS: %.elf %.elf: $(OBJS) $(NAME_OBJS) @echo "Linking $(MODULE)/$(NAME) ..." - @$(CC) $(LINKOPTS) $(OBJS) $(NAME_OBJS) -o $@ + @$(CC) $(LDFLAGS) $(OBJS) $(NAME_OBJS) -o $@ %.bin: %.elf @echo "Creating image : $@" diff --git a/README b/README index 608f10e..7b548ff 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ -This repository provides example code for the development modules made by -Techno-Innov. +This repository provides support for the LPC122x microcontroller from NXP and +example code for the development modules made by Techno-Innov. -It has support for the LPC1224 as used on the development modules, and +It has support for the LPC122x as used on the development modules, and for the peripherals found on the development modules (user led, eeprom, temperature sensor, CC1101 RF transceiver, ...). Support for various other cool stuff is added when we play with it. @@ -51,9 +51,9 @@ information. ******************** SUPPORTED FEATURES and INTERFACES -- LPC1224 micro-controller definitions +- LPC122x micro-controller definitions - Cortex-M0 specific definitions - - Cortex-M0 and LPC1224 Registers + - Cortex-M0 and LPC122x Registers - Interrupts - ROM based division routines - Utility functions to replace ctz and clz instructions (not present in Cortex M0) @@ -86,11 +86,11 @@ SUPPORTED FEATURES and INTERFACES - SPI (SSP) - PWM - RTC (partial) + - Watchdog - External Device drivers - I²C EEPROM - TMP101 I²C temperature sensor - - DHT11 temperatur and Humidity sensor - CC1101 Sub 1GHz RF Transceiver - Status led - Epaper display @@ -112,10 +112,10 @@ TODO : - Add support for SDCard over SPI - Complete RTC Support - Comparator support -- Watchdog support - CRC engine support - Test UART IrDA mode - DTPlug communication protocol tests + continue development of other functionalities. - Continue tests for NCN5120 support - More external drivers ! +- Fix DHT11 temperatur and Humidity sensor support diff --git a/lpc_link_lpc1224.ld b/lpc_link_lpc1224.ld index b3f567d..dc1b0a4 100644 --- a/lpc_link_lpc1224.ld +++ b/lpc_link_lpc1224.ld @@ -9,14 +9,11 @@ MEMORY info (rx) : ORIGIN = 0x00040200, LENGTH = 1536 } -_sram_size = 4k; -_sram_base = 0x10000000; +_sram_size = LENGTH(sram); +_sram_base = ORIGIN(sram); /* Leave 32 bytes for IAP functions, see UM10441 Chapter 20, section 20.8 */ _end_stack = (_sram_base + _sram_size - 32); -_start_info = 0x00040200; -_end_info = (_start_info + 1536); - ENTRY(Reset_Handler) @@ -27,12 +24,14 @@ SECTIONS { { FILL(0xFF); KEEP(*(.vectors)) - *(.text.Reset_Handler .text.SystemInit) + *(.text.Reset_Handler .text.system_init) . = 0x000002FC; KEEP(*(.crp)) + . = 0x00000300; *(.text*) *(.rodata*) *(.got*) + . = ALIGN(4); _end_text = .; } >flash @@ -54,6 +53,9 @@ SECTIONS { *(COMMON) _end_bss = .; } >sram + + . = ALIGN(4); + } _end = .;