Skip to content

Commit 8f57c1e

Browse files
author
Bogdan Marinescu
committed
Merge remote-tracking branch 'github/master'
2 parents 1e224c5 + f818f84 commit 8f57c1e

File tree

13 files changed

+90
-61
lines changed

13 files changed

+90
-61
lines changed

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC408X/LPC407x_8x_177x_8x.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
#ifndef __LPC407x_8x_177x_8x_H__
3535
#define __LPC407x_8x_177x_8x_H__
3636

37-
#define CORE_M4
37+
#if defined(__CORTEX_M4) && !defined(CORE_M4)
38+
#define CORE_M4
39+
#endif
3840

3941
// ##################
4042
// Code Red - excluded extern "C" as unrequired

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/TARGET_LPC4088_EA/LPC407X_8X.sct

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ LR_IROM1 0x00000000 0x00080000 { ; load region size_region
1111
RW_IRAM1 0x100000E8 0x0000FF18 { ; RW data
1212
.ANY (+RW +ZI)
1313
}
14-
RW_IRAM2 0x20000000 0x00008000 {
14+
RW_IRAM2 0x20000000 0x00004000 {
15+
.ANY (AHBSRAM0)
16+
}
17+
RW_IRAM3 0x20004000 0x00004000 {
1518
.ANY (AHBSRAM1)
1619
}
1720
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/analogin_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static const PinMap PinMap_ADC[] = {
4343

4444
void analogin_init(analogin_t *obj, PinName pin) {
4545
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
46-
if (obj->adc == (uint32_t)NC) {
46+
if (obj->adc == (ADCName)NC) {
4747
error("ADC pin mapping failed");
4848
}
4949

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/analogout_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static const PinMap PinMap_DAC[] = {
2525

2626
void analogout_init(dac_t *obj, PinName pin) {
2727
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
28-
if (obj->dac == (uint32_t)NC) {
28+
if (obj->dac == (DACName)NC) {
2929
error("DAC pin mapping failed");
3030
}
3131

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable) {
164164
obj->dev->MOD &= ~(1);
165165

166166
// Enable NVIC if at least 1 interrupt is active
167-
if((LPC_CAN1->IER | LPC_CAN2->IER) != 0) {
167+
if(((LPC_SC->PCONP & (1 << 13)) && LPC_CAN1->IER) || ((LPC_SC->PCONP & (1 << 14)) && LPC_CAN2->IER)) {
168168
NVIC_SetVector(CAN_IRQn, (uint32_t) &can_irq_n);
169169
NVIC_EnableIRQ(CAN_IRQn);
170170
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/ethernet_api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ int ethernet_receive() {
722722
if(receive_idx == -1) {
723723
receive_idx = LPC_EMAC->RxConsumeIndex;
724724
} else {
725-
while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && (receive_idx != LPC_EMAC->RxProduceIndex)) {
725+
while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && ((uint32_t)receive_idx != LPC_EMAC->RxProduceIndex)) {
726726
receive_idx = rinc(receive_idx, NUM_RX_FRAG);
727727
}
728728
unsigned int info = rxstat[receive_idx].Info;
@@ -738,7 +738,7 @@ int ethernet_receive() {
738738
LPC_EMAC->RxConsumeIndex = receive_idx;
739739
}
740740

741-
if(receive_idx == LPC_EMAC->RxProduceIndex) {
741+
if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex) {
742742
receive_idx = -1;
743743
return 0;
744744
}
@@ -787,7 +787,7 @@ int ethernet_read(char *data, int dlen) {
787787
void *pdst, *psrc;
788788
int doff = 0;
789789

790-
if(receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) {
790+
if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) {
791791
return 0;
792792
}
793793

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/gpio_irq_api.c

Lines changed: 58 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,44 +30,66 @@ static void handle_interrupt_in(void) {
3030
uint32_t fall0 = LPC_GPIOINT->IO0IntStatF;
3131
uint32_t rise2 = LPC_GPIOINT->IO2IntStatR;
3232
uint32_t fall2 = LPC_GPIOINT->IO2IntStatF;
33-
uint32_t mask0 = 0;
34-
uint32_t mask2 = 0;
35-
int i;
36-
37-
// P0.0-0.31
38-
for (i = 0; i < 32; i++) {
39-
uint32_t pmask = (1 << i);
40-
if (rise0 & pmask) {
41-
mask0 |= pmask;
42-
if (channel_ids[i] != 0)
43-
irq_handler(channel_ids[i], IRQ_RISE);
44-
}
45-
if (fall0 & pmask) {
46-
mask0 |= pmask;
47-
if (channel_ids[i] != 0)
48-
irq_handler(channel_ids[i], IRQ_FALL);
49-
}
33+
34+
uint8_t bitloc;
35+
36+
// Continue as long as there are interrupts pending
37+
while(rise0 > 0) {
38+
// CLZ returns number of leading zeros, 31 minus that is location of
39+
// first pending interrupt
40+
bitloc = 31 - __CLZ(rise0);
41+
if (channel_ids[bitloc] != 0)
42+
irq_handler(channel_ids[bitloc], IRQ_RISE); //Run that interrupt
43+
44+
// Both clear the interrupt with clear register, and remove it from
45+
// our local copy of the interrupt pending register
46+
LPC_GPIOINT->IO0IntClr = 1 << bitloc;
47+
rise0 -= 1<<bitloc;
5048
}
51-
52-
// P2.0-2.31
53-
for (i = 0; i < 32; i++) {
54-
uint32_t pmask = (1 << i);
55-
int channel_index = i + 32;
56-
if (rise2 & pmask) {
57-
mask2 |= pmask;
58-
if (channel_ids[channel_index] != 0)
59-
irq_handler(channel_ids[channel_index], IRQ_RISE);
60-
}
61-
if (fall2 & pmask) {
62-
mask2 |= pmask;
63-
if (channel_ids[channel_index] != 0)
64-
irq_handler(channel_ids[channel_index], IRQ_FALL);
65-
}
49+
50+
// Continue as long as there are interrupts pending
51+
while(fall0 > 0) {
52+
// CLZ returns number of leading zeros, 31 minus that is location of
53+
// first pending interrupt
54+
bitloc = 31 - __CLZ(fall0);
55+
if (channel_ids[bitloc] != 0)
56+
irq_handler(channel_ids[bitloc], IRQ_FALL); //Run that interrupt
57+
58+
// Both clear the interrupt with clear register, and remove it from
59+
// our local copy of the interrupt pending register
60+
LPC_GPIOINT->IO0IntClr = 1 << bitloc;
61+
fall0 -= 1<<bitloc;
62+
}
63+
64+
// Same for port 2
65+
66+
// Continue as long as there are interrupts pending
67+
while(rise2 > 0) {
68+
// CLZ returns number of leading zeros, 31 minus that is location of
69+
// first pending interrupt
70+
bitloc = 31 - __CLZ(rise2);
71+
if (channel_ids[bitloc+32] != 0)
72+
irq_handler(channel_ids[bitloc+32], IRQ_RISE); //Run that interrupt
73+
74+
// Both clear the interrupt with clear register, and remove it from
75+
// our local copy of the interrupt pending register
76+
LPC_GPIOINT->IO2IntClr = 1 << bitloc;
77+
rise2 -= 1<<bitloc;
78+
}
79+
80+
// Continue as long as there are interrupts pending
81+
while(fall2 > 0) {
82+
// CLZ returns number of leading zeros, 31 minus that is location of
83+
// first pending interrupt
84+
bitloc = 31 - __CLZ(fall2);
85+
if (channel_ids[bitloc+32] != 0)
86+
irq_handler(channel_ids[bitloc+32], IRQ_FALL); //Run that interrupt
87+
88+
// Both clear the interrupt with clear register, and remove it from
89+
// our local copy of the interrupt pending register
90+
LPC_GPIOINT->IO2IntClr = 1 << bitloc;
91+
fall2 -= 1<<bitloc;
6692
}
67-
68-
// Clear the interrupts we just handled
69-
LPC_GPIOINT->IO0IntClr = mask0;
70-
LPC_GPIOINT->IO2IntClr = mask2;
7193
}
7294

7395
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/pinmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "error.h"
1818

1919
void pin_function(PinName pin, int function) {
20-
if (pin == (uint32_t)NC) return;
20+
if (pin == (PinName)NC) return;
2121

2222
__IO uint32_t *reg = (__IO uint32_t*) (LPC_IOCON_BASE + 4 * pin);
2323

@@ -26,7 +26,7 @@ void pin_function(PinName pin, int function) {
2626
}
2727

2828
void pin_mode(PinName pin, PinMode mode) {
29-
if (pin == (uint32_t)NC) { return; }
29+
if (pin == (PinName)NC) { return; }
3030

3131
uint32_t drain = ((uint32_t) mode & (uint32_t) OpenDrain) >> 2;
3232

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/pwmout_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static unsigned int pwm_clock_mhz;
6666
void pwmout_init(pwmout_t* obj, PinName pin) {
6767
// determine the channel
6868
PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
69-
if (pwm == (uint32_t)NC)
69+
if (pwm == (PWMName)NC)
7070
error("PwmOut pin mapping failed");
7171

7272
obj->channel = pwm;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/serial_api.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,10 @@ int serial_writable(serial_t *obj) {
287287
}
288288

289289
void serial_clear(serial_t *obj) {
290-
obj->uart->FCR = 1 << 1 // rx FIFO reset
291-
| 1 << 2 // tx FIFO reset
292-
| 0 << 6; // interrupt depth
290+
obj->uart->FCR = 1 << 0 // FIFO Enable - 0 = Disables, 1 = Enabled
291+
| 1 << 1 // rx FIFO reset
292+
| 1 << 2 // tx FIFO reset
293+
| 0 << 6; // interrupt depth
293294
}
294295

295296
void serial_pinout_tx(PinName tx) {

workspace_tools/export/ds5_5_lpc11u24.cproject.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
<folderInfo id="com.arm.eclipse.build.config.baremetal.exe.debug.1914396777." name="/" resourcePath="">
1818
<toolChain errorParsers="com.arm.eclipse.builder.armcc.error" id="com.arm.toolchain.baremetal.exe.debug.1781361929" name="ARM Compiler" superClass="com.arm.toolchain.baremetal.exe.debug">
1919
<targetPlatform binaryParser="" id="com.arm.eclipse.build.config.baremetal.exe.debug.1914396777..1121504975" name=""/>
20-
<builder buildPath="${workspace_loc:/ds5_lpc11u24/Build}" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="com.arm.toolchain.baremetal.builder.1633639159" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.arm.toolchain.baremetal.builder"/>
20+
<builder autoBuildTarget="all" buildPath="${workspace_loc:/ds5_lpc11u24/Build}" cleanBuildTarget="clean" id="org.eclipse.cdt.build.core.internal.builder.1955892657" incrementalBuildTarget="all" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
2121
<tool id="com.arm.tool.c.compiler.baremetal.exe.debug.1694050615" name="ARM C Compiler" superClass="com.arm.tool.c.compiler.baremetal.exe.debug"/>
2222
<tool command="armcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="" id="com.arm.tool.cpp.compiler.baremetal.exe.debug.1642314243" name="ARM C++ Compiler" superClass="com.arm.tool.cpp.compiler.baremetal.exe.debug">
2323
<option id="com.arm.tool.c.compiler.option.targetcpu.235324898" name="Target CPU (--cpu)" superClass="com.arm.tool.c.compiler.option.targetcpu" value="Cortex-M0" valueType="string"/>
2424
<option id="com.arm.tool.c.compiler.option.incpath.1328570024" name="Include path (-I)" superClass="com.arm.tool.c.compiler.option.incpath" valueType="includePath">
25-
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ds5_lpc11u24/mbed}&quot;"/>
26-
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ds5_lpc11u24/mbed/LPC11U24/ARM}&quot;"/>
27-
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ds5_lpc11u24/mbed/LPC11U24}&quot;"/>
25+
{% for path in include_paths %}
26+
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/{{path}}}&quot;"/>
27+
{% endfor %}
2828
</option>
2929
<inputType id="com.arm.tool.c.compiler.input.51293980" superClass="com.arm.tool.c.compiler.input"/>
3030
<inputType id="com.arm.tool.cpp.compiler.input.2068563074" superClass="com.arm.tool.cpp.compiler.input"/>
@@ -34,7 +34,7 @@
3434
</tool>
3535
<tool command="armlink" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="" id="com.arm.tool.c.linker.2036393580" name="ARM Linker" superClass="com.arm.tool.c.linker">
3636
<option id="com.arm.tool.c.linker.option.cpu.419580654" name="Target CPU (--cpu)" superClass="com.arm.tool.c.linker.option.cpu" value="Cortex-M0" valueType="string"/>
37-
<option id="com.arm.tool.c.linker.option.scatter.1235987457" name="Scatter file (--scatter)" superClass="com.arm.tool.c.linker.option.scatter" value="${ProjDirPath}/mbed/LPC11U24/ARM/LPC11U24.sct" valueType="string"/>
37+
<option id="com.arm.tool.c.linker.option.scatter.1235987457" name="Scatter file (--scatter)" superClass="com.arm.tool.c.linker.option.scatter" value="${ProjDirPath}/{{ scatter_file }}" valueType="string"/>
3838
<option id="com.arm.tool.c.linker.userobjs.1389137013" name="Other object files" superClass="com.arm.tool.c.linker.userobjs" valueType="userObjs">
3939
{% for path in object_files %}
4040
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/{{path}}}&quot;"/>

workspace_tools/export/ds5_5_lpc1768.cproject.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
<folderInfo id="com.arm.eclipse.build.config.baremetal.exe.debug.1910477576." name="/" resourcePath="">
1818
<toolChain id="com.arm.toolchain.baremetal.exe.debug.1293445387" name="ARM Compiler" superClass="com.arm.toolchain.baremetal.exe.debug">
1919
<targetPlatform id="com.arm.eclipse.build.config.baremetal.exe.debug.1910477576..2093450286" name=""/>
20-
<builder buildPath="${workspace_loc:/ds5_lpc1768/Build}" id="com.arm.toolchain.baremetal.builder.457933156" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.arm.toolchain.baremetal.builder"/>
20+
<builder autoBuildTarget="all" buildPath="${workspace_loc:/ds5_lpc1768/Build}" cleanBuildTarget="clean" id="org.eclipse.cdt.build.core.internal.builder.2019880438" incrementalBuildTarget="all" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
2121
<tool id="com.arm.tool.c.compiler.baremetal.exe.debug.518028859" name="ARM C Compiler" superClass="com.arm.tool.c.compiler.baremetal.exe.debug"/>
2222
<tool id="com.arm.tool.cpp.compiler.baremetal.exe.debug.773836201" name="ARM C++ Compiler" superClass="com.arm.tool.cpp.compiler.baremetal.exe.debug">
2323
<option id="com.arm.tool.c.compiler.option.incpath.337015821" name="Include path (-I)" superClass="com.arm.tool.c.compiler.option.incpath" valueType="includePath">
24-
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/mbed/LPC1768}&quot;"/>
25-
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/mbed/LPC1768/ARM}&quot;"/>
26-
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/mbed}&quot;"/>
24+
{% for path in include_paths %}
25+
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/{{path}}}&quot;"/>
26+
{% endfor %}
2727
</option>
2828
<option id="com.arm.tool.c.compiler.option.targetcpu.1479931161" name="Target CPU (--cpu)" superClass="com.arm.tool.c.compiler.option.targetcpu" value="Cortex-M3" valueType="string"/>
2929
<inputType id="com.arm.tool.c.compiler.input.982666453" superClass="com.arm.tool.c.compiler.input"/>
@@ -34,7 +34,7 @@
3434
</tool>
3535
<tool id="com.arm.tool.c.linker.2036393580" name="ARM Linker" superClass="com.arm.tool.c.linker">
3636
<option id="com.arm.tool.c.linker.option.cpu.419580654" name="Target CPU (--cpu)" superClass="com.arm.tool.c.linker.option.cpu" value="Cortex-M3" valueType="string"/>
37-
<option id="com.arm.tool.c.linker.option.scatter.1235987457" name="Scatter file (--scatter)" superClass="com.arm.tool.c.linker.option.scatter" value="${ProjDirPath}/mbed/LPC1768/ARM/LPC1768.sct" valueType="string"/>
37+
<option id="com.arm.tool.c.linker.option.scatter.1235987457" name="Scatter file (--scatter)" superClass="com.arm.tool.c.linker.option.scatter" value="${ProjDirPath}/{{ scatter_file }}" valueType="string"/>
3838
<option id="com.arm.tool.c.linker.userobjs.1389137013" name="Other object files" superClass="com.arm.tool.c.linker.userobjs" valueType="userObjs">
3939
{% for path in object_files %}
4040
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/{{path}}}&quot;"/>
@@ -102,4 +102,4 @@
102102
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.arm.eclipse.builder.armcc.ARMCompilerDiscoveryProfile"/>
103103
</scannerConfigBuildInfo>
104104
</storageModule>
105-
</cproject>
105+
</cproject>

workspace_tools/export/uvision4_lpc4088.uvproj.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@
385385
{% for file in object_files %}
386386
{{file}}
387387
{% endfor %}
388+
--any_placement=first_fit
388389
</Misc>
389390
<LinkerInputFile></LinkerInputFile>
390391
<DisabledWarnings></DisabledWarnings>

0 commit comments

Comments
 (0)