diff --git a/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/LPC407X_8X.sct b/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/LPC407X_8X.sct index a33b0d3460..e24f8b1c05 100644 --- a/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/LPC407X_8X.sct +++ b/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/LPC407X_8X.sct @@ -6,7 +6,7 @@ LR_IROM1 0x00000000 0x00080000 { ; load region size_region ER_IROM1 0x00000000 0x00080000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) - *.o (+RO-CODE) ; forces all CODE to IFLASH + *.o (+RO-CODE) ; prioritizes CODE in IFLASH before SPIFI .ANY2 (+RO-DATA) ; prioritizes DATA in IFLASH before SPIFI .ANY (+RO) ; remaining RO } @@ -25,6 +25,7 @@ LR_IROM2 0x28000000 0x01000000 { ER_IROM2 0x28000000 0x01000000 { ; load address = execution address .ANY1 (+RO-DATA) ; all DATA not fitting in IFLASH .ANY (SPIFI_MEM) ; DATA tagged as SPIFI_MEM + *.o (SPIFI_MEM) ; CODE tagged as SPIFI_MEM } } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c index 49a2efa72c..34f1a04d24 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c @@ -204,7 +204,7 @@ static const int timing_pts[23][2] = { {0xF, 0x7}, // 24, 67% }; -static unsigned int can_speed(unsigned int sclk, unsigned int pclk, unsigned int cclk, unsigned char psjw) { +static unsigned int can_speed(unsigned int pclk, unsigned int cclk, unsigned char psjw) { uint32_t btr; uint16_t brp = 0; uint32_t calcbit; @@ -212,7 +212,7 @@ static unsigned int can_speed(unsigned int sclk, unsigned int pclk, unsigned int int hit = 0; int bits; - bitwidth = sclk / (pclk * cclk); + bitwidth = (pclk / cclk); brp = bitwidth / 0x18; while ((!hit) && (brp < bitwidth / 4)) { @@ -275,7 +275,7 @@ void can_free(can_t *obj) { int can_frequency(can_t *obj, int f) { int pclk = PeripheralClock; - int btr = can_speed(SystemCoreClock, pclk, (unsigned int)f, 1); + int btr = can_speed(pclk, (unsigned int)f, 1); if (btr > 0) { uint32_t modmask = can_disable(obj);