Fork of mbed-src file paths change. LPC1114FN28 use only.

Fork of mbed-src by mbed official

Information

この情報は2013/10/28時点での解決方法です。
現在はmbed-src、標準ライブラリで問題なくコンパイルが可能です。

・使う物
LPC1114FN28
mbed SDK

LPC1114FN28でmbed-SDKのLibraryを使うとCompile出来ない。(2013/10/28) /media/uploads/minicube/mbed_lpc1114_sdk.png

パスが通ってないだけのようなのでファイルを以下に移動する。

mbed-src\targets\cmsis\TARGET_NXP\TARGET_LPC11XX_11CXX\
mbed-src\targets\cmsis\TARGET_NXP\TARGET_LPC11XX_11CXX\TARGET_LPC11XX\

にあるファイルをすべて

mbed-src\targets\cmsis\TARGET_NXP\

へ移動

mbed-src\targets\cmsis\TARGET_NXP\TARGET_LPC11XX_11CXX\にある

TOOLCHAIN_ARM_MICRO

をフォルダごと

mbed-src\targets\cmsis\TARGET_NXP\

へ移動

mbed-src\targets\hal\TARGET_NXP\TARGET_LPC11XX_11CXX\
mbed-src\targets\hal\TARGET_NXP\TARGET_LPC11XX_11CXX\TARGET_LPC11XX\

にあるファイルをすべて

mbed-src\targets\hal\TARGET_NXP\

へ移動

移動後は以下のような構成になると思います。
※不要なファイルは削除してあります。

/media/uploads/minicube/mbed_lpc1114_sdk_tree.png


ファイルの移動が面倒なので以下に本家からフォークしたライブラリを置いておきます。

Import librarymbed-src-LPC1114FN28

Fork of mbed-src file paths change. LPC1114FN28 use only.


エラーが出力される場合

"TOOLCHAIN_ARM_MICRO"が無いとエラーになる。

Error: Undefined symbol _initial_sp (referred from entry2.o).
Error: Undefined symbol _heap_base (referred from malloc.o).
Error: Undefined symbol _heap_limit (referred from malloc.o).

LPC1114FN28はMicrolibを使ってCompileされるため上記のエラーになるようです。

Committer:
bogdanm
Date:
Wed Aug 07 16:43:59 2013 +0300
Revision:
15:4892fe388435
Parent:
13:0645d8841f51
Added LPC4088 target and interrupt chaining code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 13:0645d8841f51 1 /* mbed Microcontroller Library - cmsis_nvic for LPC11U24
bogdanm 13:0645d8841f51 2 * Copyright (c) 2011 ARM Limited. All rights reserved.
bogdanm 13:0645d8841f51 3 *
bogdanm 13:0645d8841f51 4 * CMSIS-style functionality to support dynamic vectors
bogdanm 13:0645d8841f51 5 */
bogdanm 13:0645d8841f51 6
bogdanm 13:0645d8841f51 7 #include "cmsis_nvic.h"
bogdanm 13:0645d8841f51 8
bogdanm 13:0645d8841f51 9 /* In the M0, there is no VTOR. In the LPC range such as the LPC11U,
bogdanm 13:0645d8841f51 10 * whilst the vector table may only be something like 48 entries (192 bytes, 0xC0),
bogdanm 13:0645d8841f51 11 * the SYSMEMREMAP register actually remaps the memory from 0x10000000-0x100001FF
bogdanm 13:0645d8841f51 12 * to adress 0x0-0x1FF. In this case, RAM can be addressed at both 0x10000000 and 0x0
bogdanm 13:0645d8841f51 13 *
bogdanm 13:0645d8841f51 14 * If we just copy the vectors to RAM and switch the SYSMEMMAP, any accesses to FLASH
bogdanm 13:0645d8841f51 15 * above the vector table before 0x200 will actually go to RAM. So we need to provide
bogdanm 13:0645d8841f51 16 * a solution where the compiler gets the right results based on the memory map
bogdanm 13:0645d8841f51 17 *
bogdanm 13:0645d8841f51 18 * Option 1 - We allocate and copy 0x200 of RAM rather than just the table
bogdanm 13:0645d8841f51 19 * - const data and instructions before 0x200 will be copied to and fetched/exec from RAM
bogdanm 13:0645d8841f51 20 * - RAM overhead: 0x200 - 0xC0 = 320 bytes, FLASH overhead: 0
bogdanm 13:0645d8841f51 21 *
bogdanm 13:0645d8841f51 22 * Option 2 - We pad the flash to 0x200 to ensure the compiler doesn't allocate anything there
bogdanm 13:0645d8841f51 23 * - No flash accesses will go to ram, as there will be nothing there
bogdanm 13:0645d8841f51 24 * - RAM only needs to be allocated for the vectors, as all other ram addresses are normal
bogdanm 13:0645d8841f51 25 * - RAM overhead: 0, FLASH overhead: 320 bytes
bogdanm 13:0645d8841f51 26 *
bogdanm 13:0645d8841f51 27 * Option 2 is the one to go for, as RAM is the most valuable resource
bogdanm 13:0645d8841f51 28 */
bogdanm 13:0645d8841f51 29
bogdanm 13:0645d8841f51 30 #define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Vectors positioned at start of RAM
bogdanm 13:0645d8841f51 31
bogdanm 13:0645d8841f51 32 void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
bogdanm 13:0645d8841f51 33 int i;
bogdanm 13:0645d8841f51 34 // Space for dynamic vectors, initialised to allocate in R/W
bogdanm 13:0645d8841f51 35 static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
bogdanm 13:0645d8841f51 36
bogdanm 13:0645d8841f51 37 // Copy and switch to dynamic vectors if first time called
bogdanm 13:0645d8841f51 38 if((LPC_SYSCON->SYSMEMREMAP & 0x3) != 0x1) {
bogdanm 13:0645d8841f51 39 uint32_t *old_vectors = (uint32_t *)0; // FLASH vectors are at 0x0
bogdanm 13:0645d8841f51 40 for(i = 0; i < NVIC_NUM_VECTORS; i++) {
bogdanm 13:0645d8841f51 41 vectors[i] = old_vectors[i];
bogdanm 13:0645d8841f51 42 }
bogdanm 13:0645d8841f51 43 LPC_SYSCON->SYSMEMREMAP = 0x1; // Remaps 0x0-0x1FF FLASH block to RAM block
bogdanm 13:0645d8841f51 44 }
bogdanm 13:0645d8841f51 45
bogdanm 13:0645d8841f51 46 // Set the vector
bogdanm 13:0645d8841f51 47 vectors[IRQn + 16] = vector;
bogdanm 13:0645d8841f51 48 }
bogdanm 13:0645d8841f51 49
bogdanm 13:0645d8841f51 50 uint32_t NVIC_GetVector(IRQn_Type IRQn) {
bogdanm 13:0645d8841f51 51 // We can always read vectors at 0x0, as the addresses are remapped
bogdanm 13:0645d8841f51 52 uint32_t *vectors = (uint32_t*)0;
bogdanm 13:0645d8841f51 53
bogdanm 13:0645d8841f51 54 // Return the vector
bogdanm 13:0645d8841f51 55 return vectors[IRQn + 16];
bogdanm 13:0645d8841f51 56 }
bogdanm 13:0645d8841f51 57