Merge remote-tracking branch 'upstream/master'

pull/216/head
ban4jp 2014-03-19 10:01:30 +09:00
commit e86d75f3f1
42 changed files with 326 additions and 32 deletions

View File

@ -40,7 +40,6 @@ SECTIONS
{
KEEP(*(.isr_vector))
*(.text.Reset_Handler)
*(.text.SystemInit)
/* 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

View File

@ -40,7 +40,6 @@ SECTIONS
{
KEEP(*(.isr_vector))
*(.text.Reset_Handler)
*(.text.SystemInit)
/* 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

View File

@ -76,7 +76,7 @@ serial_t stdio_uart;
struct serial_global_data_s {
uint32_t serial_irq_id;
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];
@ -100,7 +100,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
case UART_2: LPC_SC->PCONP |= 1 << 24; break;
case UART_3: LPC_SC->PCONP |= 1 << 25; break;
}
// enable fifos and default rx trigger level
obj->uart->FCR = 1 << 0 // FIFO Enable - 0 = Disables, 1 = Enabled
| 0 << 1 // Rx Fifo Reset
@ -357,6 +357,7 @@ int serial_getc(serial_t *obj) {
void serial_putc(serial_t *obj, int c) {
while (!serial_writable(obj));
obj->uart->THR = c;
uart_data[obj->index].count++;
}
int serial_readable(serial_t *obj) {
@ -364,10 +365,16 @@ int serial_readable(serial_t *obj) {
}
int serial_writable(serial_t *obj) {
int isWritable = 1;
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
else
return obj->uart->LSR & 0x20; //No flow control: writable if space in holding register
isWritable = (gpio_read(&uart_data[obj->index].sw_cts) == 0) && (obj->uart->LSR & 0x40); //If flow control: writable if CTS low + UART done
else {
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) {

View File

@ -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,
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
NC = (int)0xFFFFFFFF
} PinName;

View File

@ -1,5 +1,9 @@
#include "mbed.h"
#if defined(TARGET_STM32F407)
#define LED1 LED3
#endif
Ticker flipper_1;
DigitalOut led1(LED1);
int led1_state = 0;
@ -19,6 +23,8 @@ Ticker flipper_2;
# define LED_NAME LED2
#elif defined(TARGET_KL46Z)
# define LED_NAME LED2
#elif defined(TARGET_STM32F407)
# define LED_NAME LED4
#else
# define LED_NAME PTE31
#endif

View File

@ -20,9 +20,16 @@ from os.path import splitext, basename
class CodeRed(Exporter):
NAME = 'CodeRed'
TARGETS = ['LPC1768', 'LPC4088','LPC1114','LPC11U35_401','LPC11U35_501']
TOOLCHAIN = 'GCC_CR'
TARGETS = [
'LPC1768',
'LPC4088',
'LPC1114',
'LPC11U35_401',
'LPC11U35_501',
]
def generate(self):
libraries = []
for lib in self.resources.libraries:

View File

@ -20,8 +20,12 @@ from os.path import splitext, basename
class CodeSourcery(Exporter):
NAME = 'CodeSourcery'
TARGETS = ['LPC1768']
TOOLCHAIN = 'GCC_CS'
TARGETS = [
'LPC1768',
]
DOT_IN_RELATIVE_PATH = True
def generate(self):

View File

@ -20,14 +20,19 @@ from os.path import splitext, basename
class CoIDE(Exporter):
NAME = 'CoIDE'
TOOLCHAIN = 'GCC_ARM'
TARGETS = [
'KL25Z',
'KL05Z',
]
# seems like CoIDE currently supports only one type
FILE_TYPES = {
'c_sources':'1',
'cpp_sources':'1',
's_sources':'1'
}
TARGETS = ['KL25Z','KL05Z']
TOOLCHAIN = 'GCC_ARM'
def generate(self):
self.resources.win_to_unix()

View File

@ -20,13 +20,22 @@ from os.path import basename
class DS5_5(Exporter):
NAME = 'DS5'
TARGETS = ['LPC1768', 'LPC11U24', 'LPC812']
TARGETS = [
'LPC1768',
'LPC11U24',
'LPC812',
]
USING_MICROLIB = [
'LPC812',
]
FILE_TYPES = {
'c_sources':'1',
'cpp_sources':'8',
's_sources':'2'
}
USING_MICROLIB = ['LPC812']
def get_toolchain(self):
return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM'

View File

@ -16,18 +16,21 @@ 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
all: $(PROJECT).bin $(PROJECT).hex size
clean:
rm -f $(PROJECT).bin $(PROJECT).elf $(OBJECTS)
rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS)
.s.o:
$(AS) $(CPU) -o $@ $<
@ -41,6 +44,22 @@ clean:
$(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 $< $@
@$(OBJCOPY) -O binary $< $@
$(PROJECT).hex: $(PROJECT).elf
@$(OBJCOPY) -O ihex $< $@
$(PROJECT).lst: $(PROJECT).elf
@$(OBJDUMP) -Sdh $< > $@
lst: $(PROJECT).lst
size:
$(SIZE) $(PROJECT).elf

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -21,7 +21,21 @@ from os.path import splitext, basename
class GccArm(Exporter):
NAME = 'GccArm'
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
def generate(self):

View File

@ -19,9 +19,12 @@ from exporters import Exporter
class IAREmbeddedWorkbench(Exporter):
NAME = 'IAR'
TARGETS = ['LPC1768']
TOOLCHAIN = 'IAR'
TARGETS = [
'LPC1768',
]
def generate(self):
ctx = {
'name': self.program_name,

View File

@ -21,9 +21,40 @@ from os.path import basename
class Uvision4(Exporter):
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']
USING_MICROLIB = ['LPC11U24', 'LPC1114', 'LPC11C24', 'LPC812', 'NUCLEO_F103RB', 'NUCLEO_L152RE', 'NUCLEO_F030R8', 'NUCLEO_F401RE', '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',
]
FILE_TYPES = {
'c_sources':'1',

View File

@ -93,10 +93,13 @@ if __name__ == '__main__':
('gcc_arm', 'LPC11U35_401'),
('gcc_arm', 'LPC11U35_501'),
('gcc_arm', 'STM32F407'),
('ds5_5', 'LPC1768'), ('ds5_5', 'LPC11U24'),
('iar', 'LPC1768'),
(None, None)
]:

View File

@ -403,12 +403,10 @@ class UBLOX_C027(Target):
class NRF51822(Target):
EXPECTED_SOFTDEVICE = 's110_nrf51822_6.0.0_softdevice.hex'
OUTPUT_EXT = '.hex'
APPCODE_OFFSET = 0x14000
UICR_START = 0x10001000
UICR_END = 0x10001013
def __init__(self):
Target.__init__(self)
@ -441,14 +439,9 @@ class NRF51822(Target):
sdh = IntelHex(hexf)
sdh.merge(binh)
# Remove UICR section
del sdh[NRF51822.UICR_START:NRF51822.UICR_END+1]
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')
with open(binf.replace(".bin", ".hex"), "w") as f:
sdh.tofile(f, format = 'hex')
class LPC1549(Target):
ONLINE_TOOLCHAIN = "uARM"