mirror of https://github.com/ARMmbed/mbed-os.git
Merge remote-tracking branch 'upstream/master'
commit
e86d75f3f1
|
|
@ -40,7 +40,6 @@ SECTIONS
|
||||||
{
|
{
|
||||||
KEEP(*(.isr_vector))
|
KEEP(*(.isr_vector))
|
||||||
*(.text.Reset_Handler)
|
*(.text.Reset_Handler)
|
||||||
*(.text.SystemInit)
|
|
||||||
|
|
||||||
/* Only vectors and code running at reset are safe to be in first 512
|
/* Only vectors and code running at reset are safe to be in first 512
|
||||||
bytes since RAM can be mapped into this area for RAM based interrupt
|
bytes since RAM can be mapped into this area for RAM based interrupt
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ SECTIONS
|
||||||
{
|
{
|
||||||
KEEP(*(.isr_vector))
|
KEEP(*(.isr_vector))
|
||||||
*(.text.Reset_Handler)
|
*(.text.Reset_Handler)
|
||||||
*(.text.SystemInit)
|
|
||||||
|
|
||||||
/* Only vectors and code running at reset are safe to be in first 512
|
/* Only vectors and code running at reset are safe to be in first 512
|
||||||
bytes since RAM can be mapped into this area for RAM based interrupt
|
bytes since RAM can be mapped into this area for RAM based interrupt
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ serial_t stdio_uart;
|
||||||
struct serial_global_data_s {
|
struct serial_global_data_s {
|
||||||
uint32_t serial_irq_id;
|
uint32_t serial_irq_id;
|
||||||
gpio_t sw_rts, sw_cts;
|
gpio_t sw_rts, sw_cts;
|
||||||
uint8_t rx_irq_set_flow, rx_irq_set_api;
|
uint8_t count, rx_irq_set_flow, rx_irq_set_api;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct serial_global_data_s uart_data[UART_NUM];
|
static struct serial_global_data_s uart_data[UART_NUM];
|
||||||
|
|
@ -357,6 +357,7 @@ int serial_getc(serial_t *obj) {
|
||||||
void serial_putc(serial_t *obj, int c) {
|
void serial_putc(serial_t *obj, int c) {
|
||||||
while (!serial_writable(obj));
|
while (!serial_writable(obj));
|
||||||
obj->uart->THR = c;
|
obj->uart->THR = c;
|
||||||
|
uart_data[obj->index].count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int serial_readable(serial_t *obj) {
|
int serial_readable(serial_t *obj) {
|
||||||
|
|
@ -364,10 +365,16 @@ int serial_readable(serial_t *obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int serial_writable(serial_t *obj) {
|
int serial_writable(serial_t *obj) {
|
||||||
|
int isWritable = 1;
|
||||||
if (NC != uart_data[obj->index].sw_cts.pin)
|
if (NC != uart_data[obj->index].sw_cts.pin)
|
||||||
return (gpio_read(&uart_data[obj->index].sw_cts) == 0) && (obj->uart->LSR & 0x40); //If flow control: writable if CTS low + UART done
|
isWritable = (gpio_read(&uart_data[obj->index].sw_cts) == 0) && (obj->uart->LSR & 0x40); //If flow control: writable if CTS low + UART done
|
||||||
else
|
else {
|
||||||
return obj->uart->LSR & 0x20; //No flow control: writable if space in holding register
|
if (obj->uart->LSR & 0x20)
|
||||||
|
uart_data[obj->index].count = 0;
|
||||||
|
else if (uart_data[obj->index].count >= 16)
|
||||||
|
isWritable = 0;
|
||||||
|
}
|
||||||
|
return isWritable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serial_clear(serial_t *obj) {
|
void serial_clear(serial_t *obj) {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,11 @@ typedef enum {
|
||||||
PF_0, PF_1, PF_2, PF_3, PF_4, PF_5, PF_6, PF_7, PF_8, PF_9, PF_10, PF_11, PF_12, PF_13, PF_14, PF_15,
|
PF_0, PF_1, PF_2, PF_3, PF_4, PF_5, PF_6, PF_7, PF_8, PF_9, PF_10, PF_11, PF_12, PF_13, PF_14, PF_15,
|
||||||
PH_0, PH_1, PH_2, PH_3, PH_4, PH_5, PH_6, PH_7, PH_8, PH_9, PH_10, PH_11,
|
PH_0, PH_1, PH_2, PH_3, PH_4, PH_5, PH_6, PH_7, PH_8, PH_9, PH_10, PH_11,
|
||||||
|
|
||||||
|
LED3 = PD_13,
|
||||||
|
LED4 = PD_12,
|
||||||
|
LED5 = PD_14,
|
||||||
|
LED6 = PD_15,
|
||||||
|
|
||||||
// Not connected
|
// Not connected
|
||||||
NC = (int)0xFFFFFFFF
|
NC = (int)0xFFFFFFFF
|
||||||
} PinName;
|
} PinName;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
|
|
||||||
|
#if defined(TARGET_STM32F407)
|
||||||
|
#define LED1 LED3
|
||||||
|
#endif
|
||||||
|
|
||||||
Ticker flipper_1;
|
Ticker flipper_1;
|
||||||
DigitalOut led1(LED1);
|
DigitalOut led1(LED1);
|
||||||
int led1_state = 0;
|
int led1_state = 0;
|
||||||
|
|
@ -19,6 +23,8 @@ Ticker flipper_2;
|
||||||
# define LED_NAME LED2
|
# define LED_NAME LED2
|
||||||
#elif defined(TARGET_KL46Z)
|
#elif defined(TARGET_KL46Z)
|
||||||
# define LED_NAME LED2
|
# define LED_NAME LED2
|
||||||
|
#elif defined(TARGET_STM32F407)
|
||||||
|
# define LED_NAME LED4
|
||||||
#else
|
#else
|
||||||
# define LED_NAME PTE31
|
# define LED_NAME PTE31
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,16 @@ from os.path import splitext, basename
|
||||||
|
|
||||||
class CodeRed(Exporter):
|
class CodeRed(Exporter):
|
||||||
NAME = 'CodeRed'
|
NAME = 'CodeRed'
|
||||||
TARGETS = ['LPC1768', 'LPC4088','LPC1114','LPC11U35_401','LPC11U35_501']
|
|
||||||
TOOLCHAIN = 'GCC_CR'
|
TOOLCHAIN = 'GCC_CR'
|
||||||
|
|
||||||
|
TARGETS = [
|
||||||
|
'LPC1768',
|
||||||
|
'LPC4088',
|
||||||
|
'LPC1114',
|
||||||
|
'LPC11U35_401',
|
||||||
|
'LPC11U35_501',
|
||||||
|
]
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
libraries = []
|
libraries = []
|
||||||
for lib in self.resources.libraries:
|
for lib in self.resources.libraries:
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,12 @@ from os.path import splitext, basename
|
||||||
|
|
||||||
class CodeSourcery(Exporter):
|
class CodeSourcery(Exporter):
|
||||||
NAME = 'CodeSourcery'
|
NAME = 'CodeSourcery'
|
||||||
TARGETS = ['LPC1768']
|
|
||||||
TOOLCHAIN = 'GCC_CS'
|
TOOLCHAIN = 'GCC_CS'
|
||||||
|
|
||||||
|
TARGETS = [
|
||||||
|
'LPC1768',
|
||||||
|
]
|
||||||
|
|
||||||
DOT_IN_RELATIVE_PATH = True
|
DOT_IN_RELATIVE_PATH = True
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,19 @@ from os.path import splitext, basename
|
||||||
|
|
||||||
class CoIDE(Exporter):
|
class CoIDE(Exporter):
|
||||||
NAME = 'CoIDE'
|
NAME = 'CoIDE'
|
||||||
|
TOOLCHAIN = 'GCC_ARM'
|
||||||
|
|
||||||
|
TARGETS = [
|
||||||
|
'KL25Z',
|
||||||
|
'KL05Z',
|
||||||
|
]
|
||||||
|
|
||||||
# seems like CoIDE currently supports only one type
|
# seems like CoIDE currently supports only one type
|
||||||
FILE_TYPES = {
|
FILE_TYPES = {
|
||||||
'c_sources':'1',
|
'c_sources':'1',
|
||||||
'cpp_sources':'1',
|
'cpp_sources':'1',
|
||||||
's_sources':'1'
|
's_sources':'1'
|
||||||
}
|
}
|
||||||
TARGETS = ['KL25Z','KL05Z']
|
|
||||||
TOOLCHAIN = 'GCC_ARM'
|
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
self.resources.win_to_unix()
|
self.resources.win_to_unix()
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,22 @@ from os.path import basename
|
||||||
|
|
||||||
class DS5_5(Exporter):
|
class DS5_5(Exporter):
|
||||||
NAME = 'DS5'
|
NAME = 'DS5'
|
||||||
TARGETS = ['LPC1768', 'LPC11U24', 'LPC812']
|
|
||||||
|
TARGETS = [
|
||||||
|
'LPC1768',
|
||||||
|
'LPC11U24',
|
||||||
|
'LPC812',
|
||||||
|
]
|
||||||
|
|
||||||
|
USING_MICROLIB = [
|
||||||
|
'LPC812',
|
||||||
|
]
|
||||||
|
|
||||||
FILE_TYPES = {
|
FILE_TYPES = {
|
||||||
'c_sources':'1',
|
'c_sources':'1',
|
||||||
'cpp_sources':'8',
|
'cpp_sources':'8',
|
||||||
's_sources':'2'
|
's_sources':'2'
|
||||||
}
|
}
|
||||||
USING_MICROLIB = ['LPC812']
|
|
||||||
|
|
||||||
def get_toolchain(self):
|
def get_toolchain(self):
|
||||||
return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM'
|
return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM'
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,21 @@ CC = $(GCC_BIN)arm-none-eabi-gcc
|
||||||
CPP = $(GCC_BIN)arm-none-eabi-g++
|
CPP = $(GCC_BIN)arm-none-eabi-g++
|
||||||
LD = $(GCC_BIN)arm-none-eabi-gcc
|
LD = $(GCC_BIN)arm-none-eabi-gcc
|
||||||
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
|
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
|
||||||
|
OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
|
||||||
|
SIZE = $(GCC_BIN)arm-none-eabi-size
|
||||||
|
|
||||||
CPU = -mcpu=cortex-m0 -mthumb
|
CPU = -mcpu=cortex-m0 -mthumb
|
||||||
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
|
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
|
||||||
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
|
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
|
||||||
|
|
||||||
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
|
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
|
||||||
|
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
|
||||||
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
|
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
|
||||||
|
|
||||||
all: $(PROJECT).bin
|
all: $(PROJECT).bin $(PROJECT).hex size
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(PROJECT).bin $(PROJECT).elf $(OBJECTS)
|
rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS)
|
||||||
|
|
||||||
.s.o:
|
.s.o:
|
||||||
$(AS) $(CPU) -o $@ $<
|
$(AS) $(CPU) -o $@ $<
|
||||||
|
|
@ -41,6 +44,22 @@ clean:
|
||||||
|
|
||||||
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
|
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
|
||||||
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
|
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
|
||||||
|
@echo ""
|
||||||
|
@echo "*****"
|
||||||
|
@echo "***** You must modify vector checksum value in *.bin and *.hex files."
|
||||||
|
@echo "*****"
|
||||||
|
@echo ""
|
||||||
|
|
||||||
$(PROJECT).bin: $(PROJECT).elf
|
$(PROJECT).bin: $(PROJECT).elf
|
||||||
$(OBJCOPY) -O binary $< $@
|
@$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
|
$(PROJECT).hex: $(PROJECT).elf
|
||||||
|
@$(OBJCOPY) -O ihex $< $@
|
||||||
|
|
||||||
|
$(PROJECT).lst: $(PROJECT).elf
|
||||||
|
@$(OBJDUMP) -Sdh $< > $@
|
||||||
|
|
||||||
|
lst: $(PROJECT).lst
|
||||||
|
|
||||||
|
size:
|
||||||
|
$(SIZE) $(PROJECT).elf
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
# 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=cortex-m0 -mthumb
|
||||||
|
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
|
||||||
|
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
|
||||||
|
|
||||||
|
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
|
||||||
|
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
|
||||||
|
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
|
||||||
|
|
||||||
|
all: $(PROJECT).bin $(PROJECT).hex size
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS)
|
||||||
|
|
||||||
|
.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)
|
||||||
|
@echo ""
|
||||||
|
@echo "*****"
|
||||||
|
@echo "***** You must modify vector checksum value in *.bin and *.hex files."
|
||||||
|
@echo "*****"
|
||||||
|
@echo ""
|
||||||
|
|
||||||
|
$(PROJECT).bin: $(PROJECT).elf
|
||||||
|
@$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
|
$(PROJECT).hex: $(PROJECT).elf
|
||||||
|
@$(OBJCOPY) -O ihex $< $@
|
||||||
|
|
||||||
|
$(PROJECT).lst: $(PROJECT).elf
|
||||||
|
@$(OBJDUMP) -Sdh $< > $@
|
||||||
|
|
||||||
|
lst: $(PROJECT).lst
|
||||||
|
|
||||||
|
size:
|
||||||
|
$(SIZE) $(PROJECT).elf
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
# 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=cortex-m0 -mthumb
|
||||||
|
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
|
||||||
|
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
|
||||||
|
|
||||||
|
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
|
||||||
|
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
|
||||||
|
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
|
||||||
|
|
||||||
|
all: $(PROJECT).bin $(PROJECT).hex size
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS)
|
||||||
|
|
||||||
|
.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)
|
||||||
|
@echo ""
|
||||||
|
@echo "*****"
|
||||||
|
@echo "***** You must modify vector checksum value in *.bin and *.hex files."
|
||||||
|
@echo "*****"
|
||||||
|
@echo ""
|
||||||
|
|
||||||
|
$(PROJECT).bin: $(PROJECT).elf
|
||||||
|
@$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
|
$(PROJECT).hex: $(PROJECT).elf
|
||||||
|
@$(OBJCOPY) -O ihex $< $@
|
||||||
|
|
||||||
|
$(PROJECT).lst: $(PROJECT).elf
|
||||||
|
@$(OBJDUMP) -Sdh $< > $@
|
||||||
|
|
||||||
|
lst: $(PROJECT).lst
|
||||||
|
|
||||||
|
size:
|
||||||
|
$(SIZE) $(PROJECT).elf
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
# 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=cortex-m4 -mthumb
|
||||||
|
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
|
||||||
|
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
|
||||||
|
|
||||||
|
LD_FLAGS = -mcpu=cortex-m3 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
|
||||||
|
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
|
||||||
|
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
|
||||||
|
|
||||||
|
all: $(PROJECT).bin $(PROJECT).hex size
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS)
|
||||||
|
|
||||||
|
.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) -Sdh $< > $@
|
||||||
|
|
||||||
|
lst: $(PROJECT).lst
|
||||||
|
|
||||||
|
size:
|
||||||
|
$(SIZE) $(PROJECT).elf
|
||||||
|
|
@ -21,7 +21,21 @@ from os.path import splitext, basename
|
||||||
class GccArm(Exporter):
|
class GccArm(Exporter):
|
||||||
NAME = 'GccArm'
|
NAME = 'GccArm'
|
||||||
TOOLCHAIN = 'GCC_ARM'
|
TOOLCHAIN = 'GCC_ARM'
|
||||||
TARGETS = ['LPC1768','KL05Z','KL25Z','KL46Z','K20D5M','LPC4088','LPC11U24','LPC1114','LPC11U35_401','LPC11U35_501']
|
|
||||||
|
TARGETS = [
|
||||||
|
'LPC1768',
|
||||||
|
'KL05Z',
|
||||||
|
'KL25Z',
|
||||||
|
'KL46Z',
|
||||||
|
'K20D5M',
|
||||||
|
'LPC4088',
|
||||||
|
'LPC11U24',
|
||||||
|
'LPC1114',
|
||||||
|
'LPC11U35_401',
|
||||||
|
'LPC11U35_501',
|
||||||
|
'STM32F407',
|
||||||
|
]
|
||||||
|
|
||||||
DOT_IN_RELATIVE_PATH = True
|
DOT_IN_RELATIVE_PATH = True
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,12 @@ from exporters import Exporter
|
||||||
|
|
||||||
class IAREmbeddedWorkbench(Exporter):
|
class IAREmbeddedWorkbench(Exporter):
|
||||||
NAME = 'IAR'
|
NAME = 'IAR'
|
||||||
TARGETS = ['LPC1768']
|
|
||||||
TOOLCHAIN = 'IAR'
|
TOOLCHAIN = 'IAR'
|
||||||
|
|
||||||
|
TARGETS = [
|
||||||
|
'LPC1768',
|
||||||
|
]
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
ctx = {
|
ctx = {
|
||||||
'name': self.program_name,
|
'name': self.program_name,
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,40 @@ from os.path import basename
|
||||||
class Uvision4(Exporter):
|
class Uvision4(Exporter):
|
||||||
NAME = 'uVision4'
|
NAME = 'uVision4'
|
||||||
|
|
||||||
TARGETS = ['LPC1768', 'LPC11U24', 'KL05Z', 'KL25Z', 'KL46Z', 'K20D5M', 'LPC1347', 'LPC1114', 'LPC11C24', 'LPC4088', 'LPC812', 'NUCLEO_F103RB', 'NUCLEO_L152RE', 'NUCLEO_F030R8', 'NUCLEO_F401RE', 'UBLOX_C027', 'LPC1549', 'LPC11U35_501']
|
TARGETS = [
|
||||||
|
'LPC1768',
|
||||||
|
'LPC11U24',
|
||||||
|
'KL05Z',
|
||||||
|
'KL25Z',
|
||||||
|
'KL46Z',
|
||||||
|
'K64F',
|
||||||
|
'K20D5M',
|
||||||
|
'LPC1347',
|
||||||
|
'LPC1114',
|
||||||
|
'LPC11C24',
|
||||||
|
'LPC4088',
|
||||||
|
'LPC812',
|
||||||
|
'NUCLEO_F103RB',
|
||||||
|
'NUCLEO_L152RE',
|
||||||
|
'NUCLEO_F030R8',
|
||||||
|
'NUCLEO_F401RE',
|
||||||
|
'UBLOX_C027',
|
||||||
|
'LPC1549',
|
||||||
|
'LPC11U35_501',
|
||||||
|
]
|
||||||
|
|
||||||
USING_MICROLIB = ['LPC11U24', 'LPC1114', 'LPC11C24', 'LPC812', 'NUCLEO_F103RB', 'NUCLEO_L152RE', 'NUCLEO_F030R8', 'NUCLEO_F401RE', 'LPC1549', 'LPC11U35_501']
|
USING_MICROLIB = [
|
||||||
|
'LPC11U24',
|
||||||
|
'LPC1114',
|
||||||
|
'LPC11C24',
|
||||||
|
'LPC812',
|
||||||
|
'NUCLEO_F103RB',
|
||||||
|
'NUCLEO_L152RE',
|
||||||
|
'NUCLEO_F030R8',
|
||||||
|
'NUCLEO_F401RE',
|
||||||
|
'LPC1549',
|
||||||
|
'LPC11U35_501',
|
||||||
|
]
|
||||||
|
|
||||||
FILE_TYPES = {
|
FILE_TYPES = {
|
||||||
'c_sources':'1',
|
'c_sources':'1',
|
||||||
|
|
|
||||||
|
|
@ -93,11 +93,14 @@ if __name__ == '__main__':
|
||||||
('gcc_arm', 'LPC11U35_401'),
|
('gcc_arm', 'LPC11U35_401'),
|
||||||
('gcc_arm', 'LPC11U35_501'),
|
('gcc_arm', 'LPC11U35_501'),
|
||||||
|
|
||||||
|
('gcc_arm', 'STM32F407'),
|
||||||
|
|
||||||
|
|
||||||
('ds5_5', 'LPC1768'), ('ds5_5', 'LPC11U24'),
|
('ds5_5', 'LPC1768'), ('ds5_5', 'LPC11U24'),
|
||||||
|
|
||||||
('iar', 'LPC1768'),
|
('iar', 'LPC1768'),
|
||||||
|
|
||||||
|
|
||||||
(None, None)
|
(None, None)
|
||||||
]:
|
]:
|
||||||
print '\n=== Exporting to "%s::%s" ===' % (toolchain, target)
|
print '\n=== Exporting to "%s::%s" ===' % (toolchain, target)
|
||||||
|
|
|
||||||
|
|
@ -403,12 +403,10 @@ class UBLOX_C027(Target):
|
||||||
|
|
||||||
class NRF51822(Target):
|
class NRF51822(Target):
|
||||||
EXPECTED_SOFTDEVICE = 's110_nrf51822_6.0.0_softdevice.hex'
|
EXPECTED_SOFTDEVICE = 's110_nrf51822_6.0.0_softdevice.hex'
|
||||||
|
OUTPUT_EXT = '.hex'
|
||||||
|
|
||||||
APPCODE_OFFSET = 0x14000
|
APPCODE_OFFSET = 0x14000
|
||||||
|
|
||||||
UICR_START = 0x10001000
|
|
||||||
UICR_END = 0x10001013
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Target.__init__(self)
|
Target.__init__(self)
|
||||||
|
|
||||||
|
|
@ -441,14 +439,9 @@ class NRF51822(Target):
|
||||||
sdh = IntelHex(hexf)
|
sdh = IntelHex(hexf)
|
||||||
sdh.merge(binh)
|
sdh.merge(binh)
|
||||||
|
|
||||||
# Remove UICR section
|
with open(binf.replace(".bin", ".hex"), "w") as f:
|
||||||
del sdh[NRF51822.UICR_START:NRF51822.UICR_END+1]
|
sdh.tofile(f, format = 'hex')
|
||||||
|
|
||||||
with open(binf, "wb") as f:
|
|
||||||
sdh.tofile(f, format = 'bin')
|
|
||||||
|
|
||||||
#with open(binf.replace(".bin", ".hex"), "w") as f:
|
|
||||||
# sdh.tofile(f, format = 'hex')
|
|
||||||
|
|
||||||
class LPC1549(Target):
|
class LPC1549(Target):
|
||||||
ONLINE_TOOLCHAIN = "uARM"
|
ONLINE_TOOLCHAIN = "uARM"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue