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:
Mon Aug 05 14:12:34 2013 +0300
Revision:
13:0645d8841f51
Parent:
vendor/NXP/LPC1768/cmsis/GCC_CS/sys.cpp@10:3bc89ef62ce7
Update mbed sources to revision 64

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 10:3bc89ef62ce7 1 #include "cmsis.h"
emilmont 10:3bc89ef62ce7 2 #include <sys/types.h>
emilmont 10:3bc89ef62ce7 3 #include <errno.h>
emilmont 10:3bc89ef62ce7 4
emilmont 10:3bc89ef62ce7 5 extern "C" {
emilmont 10:3bc89ef62ce7 6
emilmont 10:3bc89ef62ce7 7 struct SCS3Regions {
emilmont 10:3bc89ef62ce7 8 unsigned long Dummy;
emilmont 10:3bc89ef62ce7 9 unsigned long* InitRam;
emilmont 10:3bc89ef62ce7 10 unsigned long* StartRam;
emilmont 10:3bc89ef62ce7 11 unsigned long InitSizeRam;
emilmont 10:3bc89ef62ce7 12 unsigned long ZeroSizeRam;
emilmont 10:3bc89ef62ce7 13 };
emilmont 10:3bc89ef62ce7 14
emilmont 10:3bc89ef62ce7 15 extern unsigned long __cs3_regions;
emilmont 10:3bc89ef62ce7 16 extern unsigned long __cs3_heap_start;
emilmont 10:3bc89ef62ce7 17
emilmont 10:3bc89ef62ce7 18 int main(void);
emilmont 10:3bc89ef62ce7 19 void __libc_init_array(void);
emilmont 10:3bc89ef62ce7 20 void exit(int ErrorCode);
emilmont 10:3bc89ef62ce7 21
emilmont 10:3bc89ef62ce7 22 static void *heap_pointer = NULL;
emilmont 10:3bc89ef62ce7 23
emilmont 10:3bc89ef62ce7 24 void __cs3_start_c(void) {
emilmont 10:3bc89ef62ce7 25 static SCS3Regions* pCS3Regions = (SCS3Regions*)&__cs3_regions;
emilmont 10:3bc89ef62ce7 26 unsigned long* pulDest;
emilmont 10:3bc89ef62ce7 27 unsigned long* pulSrc;
emilmont 10:3bc89ef62ce7 28 unsigned long ByteCount;
emilmont 10:3bc89ef62ce7 29 unsigned long i;
emilmont 10:3bc89ef62ce7 30
emilmont 10:3bc89ef62ce7 31 pulSrc = pCS3Regions->InitRam;
emilmont 10:3bc89ef62ce7 32 pulDest = pCS3Regions->StartRam;
emilmont 10:3bc89ef62ce7 33 ByteCount = pCS3Regions->InitSizeRam;
emilmont 10:3bc89ef62ce7 34 if (pulSrc != pulDest) {
emilmont 10:3bc89ef62ce7 35 for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
emilmont 10:3bc89ef62ce7 36 *(pulDest++) = *(pulSrc++);
emilmont 10:3bc89ef62ce7 37 }
emilmont 10:3bc89ef62ce7 38 } else {
emilmont 10:3bc89ef62ce7 39 pulDest = (unsigned long*)(void*)((char*)pulDest + ByteCount);
emilmont 10:3bc89ef62ce7 40 }
emilmont 10:3bc89ef62ce7 41
emilmont 10:3bc89ef62ce7 42 ByteCount = pCS3Regions->ZeroSizeRam;
emilmont 10:3bc89ef62ce7 43 for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
emilmont 10:3bc89ef62ce7 44 *(pulDest++) = 0;
emilmont 10:3bc89ef62ce7 45 }
emilmont 10:3bc89ef62ce7 46
emilmont 10:3bc89ef62ce7 47 heap_pointer = &__cs3_heap_start;
emilmont 10:3bc89ef62ce7 48 __libc_init_array();
emilmont 10:3bc89ef62ce7 49
emilmont 10:3bc89ef62ce7 50 exit(main());
emilmont 10:3bc89ef62ce7 51 }
emilmont 10:3bc89ef62ce7 52
emilmont 10:3bc89ef62ce7 53 int _kill(int pid, int sig) {
emilmont 10:3bc89ef62ce7 54 errno = EINVAL;
emilmont 10:3bc89ef62ce7 55 return -1;
emilmont 10:3bc89ef62ce7 56 }
emilmont 10:3bc89ef62ce7 57
emilmont 10:3bc89ef62ce7 58 void _exit(int status) {
emilmont 10:3bc89ef62ce7 59 exit(status);
emilmont 10:3bc89ef62ce7 60 }
emilmont 10:3bc89ef62ce7 61
emilmont 10:3bc89ef62ce7 62 int _getpid(void) {
emilmont 10:3bc89ef62ce7 63 return 1;
emilmont 10:3bc89ef62ce7 64 }
emilmont 10:3bc89ef62ce7 65
emilmont 10:3bc89ef62ce7 66 void *_sbrk(unsigned int incr) {
emilmont 10:3bc89ef62ce7 67 void *mem;
emilmont 10:3bc89ef62ce7 68
emilmont 10:3bc89ef62ce7 69 unsigned int next = ((((unsigned int)heap_pointer + incr) + 7) & ~7);
emilmont 10:3bc89ef62ce7 70 if (next > __get_MSP()) {
emilmont 10:3bc89ef62ce7 71 mem = NULL;
emilmont 10:3bc89ef62ce7 72 } else {
emilmont 10:3bc89ef62ce7 73 mem = (void *)heap_pointer;
emilmont 10:3bc89ef62ce7 74 }
emilmont 10:3bc89ef62ce7 75 heap_pointer = (void *)next;
emilmont 10:3bc89ef62ce7 76
emilmont 10:3bc89ef62ce7 77 return mem;
emilmont 10:3bc89ef62ce7 78 }
emilmont 10:3bc89ef62ce7 79
emilmont 10:3bc89ef62ce7 80 }