Fork of mbed-src file paths change. LPC1114FN28 use only.
Fork of mbed-src by
Information
この情報は2013/10/28時点での解決方法です。
現在はmbed-src、標準ライブラリで問題なくコンパイルが可能です。
・使う物
LPC1114FN28
mbed SDK
LPC1114FN28でmbed-SDKのLibraryを使うとCompile出来ない。(2013/10/28)
パスが通ってないだけのようなのでファイルを以下に移動する。
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\ |
へ移動
移動後は以下のような構成になると思います。
※不要なファイルは削除してあります。
ファイルの移動が面倒なので以下に本家からフォークしたライブラリを置いておきます。
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されるため上記のエラーになるようです。
targets/hal/TARGET_Freescale/TARGET_KL46Z/analogout_api.c@42:7ca0bbba899b, 2013-10-27 (annotated)
- Committer:
- mbed_official
- Date:
- Sun Oct 27 16:30:04 2013 +0000
- Revision:
- 42:7ca0bbba899b
- Parent:
- 31:42176bc3c368
Synchronized with git revision 5aad98af4bfbd03abf27c71b506d6ac0f295c4c6
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 31:42176bc3c368 | 1 | /* mbed Microcontroller Library |
mbed_official | 31:42176bc3c368 | 2 | * Copyright (c) 2006-2013 ARM Limited |
mbed_official | 31:42176bc3c368 | 3 | * |
mbed_official | 31:42176bc3c368 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mbed_official | 31:42176bc3c368 | 5 | * you may not use this file except in compliance with the License. |
mbed_official | 31:42176bc3c368 | 6 | * You may obtain a copy of the License at |
mbed_official | 31:42176bc3c368 | 7 | * |
mbed_official | 31:42176bc3c368 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbed_official | 31:42176bc3c368 | 9 | * |
mbed_official | 31:42176bc3c368 | 10 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 31:42176bc3c368 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 31:42176bc3c368 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 31:42176bc3c368 | 13 | * See the License for the specific language governing permissions and |
mbed_official | 31:42176bc3c368 | 14 | * limitations under the License. |
mbed_official | 31:42176bc3c368 | 15 | */ |
mbed_official | 31:42176bc3c368 | 16 | #include "analogout_api.h" |
mbed_official | 31:42176bc3c368 | 17 | |
mbed_official | 31:42176bc3c368 | 18 | #include "cmsis.h" |
mbed_official | 31:42176bc3c368 | 19 | #include "pinmap.h" |
mbed_official | 31:42176bc3c368 | 20 | #include "error.h" |
mbed_official | 31:42176bc3c368 | 21 | |
mbed_official | 31:42176bc3c368 | 22 | #define RANGE_12BIT 0xFFF |
mbed_official | 31:42176bc3c368 | 23 | |
mbed_official | 31:42176bc3c368 | 24 | static const PinMap PinMap_DAC[] = { |
mbed_official | 31:42176bc3c368 | 25 | {PTE30, DAC_0, 0}, |
mbed_official | 31:42176bc3c368 | 26 | {NC , NC , 0} |
mbed_official | 31:42176bc3c368 | 27 | }; |
mbed_official | 31:42176bc3c368 | 28 | |
mbed_official | 31:42176bc3c368 | 29 | void analogout_init(dac_t *obj, PinName pin) { |
mbed_official | 31:42176bc3c368 | 30 | obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC); |
mbed_official | 31:42176bc3c368 | 31 | if (obj->dac == (DACName)NC) { |
mbed_official | 31:42176bc3c368 | 32 | error("DAC pin mapping failed"); |
mbed_official | 31:42176bc3c368 | 33 | } |
mbed_official | 31:42176bc3c368 | 34 | |
mbed_official | 31:42176bc3c368 | 35 | SIM->SCGC6 |= SIM_SCGC6_DAC0_MASK; |
mbed_official | 31:42176bc3c368 | 36 | |
mbed_official | 31:42176bc3c368 | 37 | uint32_t port = (uint32_t)pin >> PORT_SHIFT; |
mbed_official | 31:42176bc3c368 | 38 | SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port); |
mbed_official | 31:42176bc3c368 | 39 | |
mbed_official | 31:42176bc3c368 | 40 | DAC0->DAT[obj->dac].DATH = 0; |
mbed_official | 31:42176bc3c368 | 41 | DAC0->DAT[obj->dac].DATL = 0; |
mbed_official | 31:42176bc3c368 | 42 | |
mbed_official | 31:42176bc3c368 | 43 | DAC0->C1 = DAC_C1_DACBFMD_MASK; // One-Time Scan Mode |
mbed_official | 31:42176bc3c368 | 44 | |
mbed_official | 31:42176bc3c368 | 45 | DAC0->C0 = DAC_C0_DACEN_MASK // Enable |
mbed_official | 31:42176bc3c368 | 46 | | DAC_C0_DACSWTRG_MASK; // Software Trigger |
mbed_official | 31:42176bc3c368 | 47 | |
mbed_official | 31:42176bc3c368 | 48 | pinmap_pinout(pin, PinMap_DAC); |
mbed_official | 31:42176bc3c368 | 49 | |
mbed_official | 31:42176bc3c368 | 50 | analogout_write_u16(obj, 0); |
mbed_official | 31:42176bc3c368 | 51 | } |
mbed_official | 31:42176bc3c368 | 52 | |
mbed_official | 31:42176bc3c368 | 53 | void analogout_free(dac_t *obj) {} |
mbed_official | 31:42176bc3c368 | 54 | |
mbed_official | 31:42176bc3c368 | 55 | static inline void dac_write(dac_t *obj, int value) { |
mbed_official | 31:42176bc3c368 | 56 | DAC0->DAT[obj->dac].DATL = (uint8_t)( value & 0xFF); |
mbed_official | 31:42176bc3c368 | 57 | DAC0->DAT[obj->dac].DATH = (uint8_t)((value >> 8) & 0xFF); |
mbed_official | 31:42176bc3c368 | 58 | } |
mbed_official | 31:42176bc3c368 | 59 | |
mbed_official | 31:42176bc3c368 | 60 | static inline int dac_read(dac_t *obj) { |
mbed_official | 31:42176bc3c368 | 61 | return ((DAC0->DAT[obj->dac].DATH << 8) | DAC0->DAT[obj->dac].DATL); |
mbed_official | 31:42176bc3c368 | 62 | } |
mbed_official | 31:42176bc3c368 | 63 | |
mbed_official | 31:42176bc3c368 | 64 | void analogout_write(dac_t *obj, float value) { |
mbed_official | 31:42176bc3c368 | 65 | if (value < 0.0) { |
mbed_official | 31:42176bc3c368 | 66 | dac_write(obj, 0); |
mbed_official | 31:42176bc3c368 | 67 | } else if (value > 1.0) { |
mbed_official | 31:42176bc3c368 | 68 | dac_write(obj, RANGE_12BIT); |
mbed_official | 31:42176bc3c368 | 69 | } else { |
mbed_official | 31:42176bc3c368 | 70 | dac_write(obj, value * (float)RANGE_12BIT); |
mbed_official | 31:42176bc3c368 | 71 | } |
mbed_official | 31:42176bc3c368 | 72 | } |
mbed_official | 31:42176bc3c368 | 73 | |
mbed_official | 31:42176bc3c368 | 74 | void analogout_write_u16(dac_t *obj, uint16_t value) { |
mbed_official | 31:42176bc3c368 | 75 | dac_write(obj, value >> 4); // 12-bit |
mbed_official | 31:42176bc3c368 | 76 | } |
mbed_official | 31:42176bc3c368 | 77 | |
mbed_official | 31:42176bc3c368 | 78 | float analogout_read(dac_t *obj) { |
mbed_official | 31:42176bc3c368 | 79 | uint32_t value = dac_read(obj); |
mbed_official | 31:42176bc3c368 | 80 | return (float)value * (1.0f / (float)RANGE_12BIT); |
mbed_official | 31:42176bc3c368 | 81 | } |
mbed_official | 31:42176bc3c368 | 82 | |
mbed_official | 31:42176bc3c368 | 83 | uint16_t analogout_read_u16(dac_t *obj) { |
mbed_official | 31:42176bc3c368 | 84 | uint32_t value = dac_read(obj); // 12-bit |
mbed_official | 31:42176bc3c368 | 85 | return (value << 4) | ((value >> 8) & 0x003F); |
mbed_official | 31:42176bc3c368 | 86 | } |