Skip to content

Commit

Permalink
Merge branch 'mbed.org/master'
Browse files Browse the repository at this point in the history
Conflicts:
	workspace_tools/export/gccarm.py
  • Loading branch information
dinau committed Mar 18, 2014
2 parents 6e09762 + b95ba7a commit 64df527
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 26 deletions.
17 changes: 12 additions & 5 deletions libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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
Expand Down Expand Up @@ -357,17 +357,24 @@ 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) {
return obj->uart->LSR & 0x01;
}

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) {
Expand Down
9 changes: 8 additions & 1 deletion workspace_tools/export/codered.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@

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:
Expand Down
6 changes: 5 additions & 1 deletion workspace_tools/export/codesourcery.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@

class CodeSourcery(Exporter):
NAME = 'CodeSourcery'
TARGETS = ['LPC1768']
TOOLCHAIN = 'GCC_CS'

TARGETS = [
'LPC1768',
]

DOT_IN_RELATIVE_PATH = True

def generate(self):
Expand Down
9 changes: 7 additions & 2 deletions workspace_tools/export/coide.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@

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()
Expand Down
13 changes: 11 additions & 2 deletions workspace_tools/export/ds5_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,22 @@

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'
Expand Down
5 changes: 4 additions & 1 deletion workspace_tools/export/iar.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@

class IAREmbeddedWorkbench(Exporter):
NAME = 'IAR'
TARGETS = ['LPC1768']
TOOLCHAIN = 'IAR'

TARGETS = [
'LPC1768',
]

def generate(self):
ctx = {
'name': self.program_name,
Expand Down
37 changes: 34 additions & 3 deletions workspace_tools/export/uvision4.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,40 @@
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',
Expand Down
15 changes: 4 additions & 11 deletions workspace_tools/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,10 @@ def __init__(self):

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)

Expand Down Expand Up @@ -441,14 +439,9 @@ def binary_hook(t_self, resources, elf, binf):
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"
Expand Down

0 comments on commit 64df527

Please sign in to comment.