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
Child:
29:6ac4027eff2b
Added LPC4088 target and interrupt chaining code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 15:4892fe388435 1 /* mbed Microcontroller Library
bogdanm 15:4892fe388435 2 * Copyright (c) 2006-2013 ARM Limited
bogdanm 15:4892fe388435 3 *
bogdanm 15:4892fe388435 4 * Licensed under the Apache License, Version 2.0 (the "License");
bogdanm 15:4892fe388435 5 * you may not use this file except in compliance with the License.
bogdanm 15:4892fe388435 6 * You may obtain a copy of the License at
bogdanm 15:4892fe388435 7 *
bogdanm 15:4892fe388435 8 * http://www.apache.org/licenses/LICENSE-2.0
bogdanm 15:4892fe388435 9 *
bogdanm 15:4892fe388435 10 * Unless required by applicable law or agreed to in writing, software
bogdanm 15:4892fe388435 11 * distributed under the License is distributed on an "AS IS" BASIS,
bogdanm 15:4892fe388435 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bogdanm 15:4892fe388435 13 * See the License for the specific language governing permissions and
bogdanm 15:4892fe388435 14 * limitations under the License.
bogdanm 15:4892fe388435 15 */
bogdanm 15:4892fe388435 16 #include "analogout_api.h"
bogdanm 15:4892fe388435 17 #include "cmsis.h"
bogdanm 15:4892fe388435 18 #include "pinmap.h"
bogdanm 15:4892fe388435 19 #include "error.h"
bogdanm 15:4892fe388435 20
bogdanm 15:4892fe388435 21 static const PinMap PinMap_DAC[] = {
bogdanm 15:4892fe388435 22 {P0_26, DAC_0, 2},
bogdanm 15:4892fe388435 23 {NC , NC , 0}
bogdanm 15:4892fe388435 24 };
bogdanm 15:4892fe388435 25
bogdanm 15:4892fe388435 26 void analogout_init(dac_t *obj, PinName pin) {
bogdanm 15:4892fe388435 27 obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
bogdanm 15:4892fe388435 28 if (obj->dac == (uint32_t)NC) {
bogdanm 15:4892fe388435 29 error("DAC pin mapping failed");
bogdanm 15:4892fe388435 30 }
bogdanm 15:4892fe388435 31
bogdanm 15:4892fe388435 32 // DAC enable bit must be set
bogdanm 15:4892fe388435 33 LPC_IOCON->P0_26 |= (1 << 16); // DACEN
bogdanm 15:4892fe388435 34
bogdanm 15:4892fe388435 35 // map out (must be done before accessing registers)
bogdanm 15:4892fe388435 36 pinmap_pinout(pin, PinMap_DAC);
bogdanm 15:4892fe388435 37
bogdanm 15:4892fe388435 38 analogout_write_u16(obj, 0);
bogdanm 15:4892fe388435 39 }
bogdanm 15:4892fe388435 40
bogdanm 15:4892fe388435 41 void analogout_free(dac_t *obj) {}
bogdanm 15:4892fe388435 42
bogdanm 15:4892fe388435 43 static inline void dac_write(int value) {
bogdanm 15:4892fe388435 44 value &= 0x3FF; // 10-bit
bogdanm 15:4892fe388435 45
bogdanm 15:4892fe388435 46 // Set the DAC output
bogdanm 15:4892fe388435 47 LPC_DAC->CR = (0 << 16) // bias = 0
bogdanm 15:4892fe388435 48 | (value << 6);
bogdanm 15:4892fe388435 49 }
bogdanm 15:4892fe388435 50
bogdanm 15:4892fe388435 51 static inline int dac_read() {
bogdanm 15:4892fe388435 52 return (LPC_DAC->CR >> 6) & 0x3FF;
bogdanm 15:4892fe388435 53 }
bogdanm 15:4892fe388435 54
bogdanm 15:4892fe388435 55 void analogout_write(dac_t *obj, float value) {
bogdanm 15:4892fe388435 56 if (value < 0.0f) {
bogdanm 15:4892fe388435 57 dac_write(0);
bogdanm 15:4892fe388435 58 } else if (value > 1.0f) {
bogdanm 15:4892fe388435 59 dac_write(0x3FF);
bogdanm 15:4892fe388435 60 } else {
bogdanm 15:4892fe388435 61 dac_write(value * (float)0x3FF);
bogdanm 15:4892fe388435 62 }
bogdanm 15:4892fe388435 63 }
bogdanm 15:4892fe388435 64
bogdanm 15:4892fe388435 65 void analogout_write_u16(dac_t *obj, uint16_t value) {
bogdanm 15:4892fe388435 66 dac_write(value >> 6); // 10-bit
bogdanm 15:4892fe388435 67 }
bogdanm 15:4892fe388435 68
bogdanm 15:4892fe388435 69 float analogout_read(dac_t *obj) {
bogdanm 15:4892fe388435 70 uint32_t value = dac_read();
bogdanm 15:4892fe388435 71 return (float)value * (1.0f / (float)0x3FF);
bogdanm 15:4892fe388435 72 }
bogdanm 15:4892fe388435 73
bogdanm 15:4892fe388435 74 uint16_t analogout_read_u16(dac_t *obj) {
bogdanm 15:4892fe388435 75 uint32_t value = dac_read(); // 10-bit
bogdanm 15:4892fe388435 76 return (value << 6) | ((value >> 4) & 0x003F);
bogdanm 15:4892fe388435 77 }