This commit adds the bbc-microbit-armcc target, and also includes the microbit dal, showing how the microbit can be compiled using yotta.master
commit
c5c2cfb221
@ -0,0 +1,7 @@
|
||||
build
|
||||
yotta_modules
|
||||
yotta_targets/*
|
||||
|
||||
!.gitignore
|
||||
|
||||
!yotta_targets/bbc-microbit-armcc
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"build": {
|
||||
"target": "bbc-microbit-armcc,*"
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "microbit",
|
||||
"version": "0.0.1",
|
||||
"description": "The micro:bit runtime, building with yotta",
|
||||
"licenses": [
|
||||
{
|
||||
"url": "https://spdx.org/licenses/Apache-2.0",
|
||||
"type": "Apache-2.0"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"mbed-classic": "~0.0.4",
|
||||
"ble": "jamesadevine/BLE_API",
|
||||
"ble-nrf51822": "jamesadevine/nrf51822",
|
||||
"microbit-dal":"jamesadevine/microbit-dal"
|
||||
},
|
||||
"targetDependencies": {},
|
||||
"bin": "./source"
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2015 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "MicroBit.h"
|
||||
|
||||
DigitalOut led1(LED1);
|
||||
|
||||
void periodicCallback(void)
|
||||
{
|
||||
/* Do blinky on LED1 while we're waiting for BLE events */
|
||||
}
|
||||
|
||||
void app_main()
|
||||
{
|
||||
led1 = 1;
|
||||
|
||||
// infinite loop
|
||||
while (1)
|
||||
{
|
||||
uBit.display.scrollString("ABC123");
|
||||
uBit.sleep(1000);
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
build
|
||||
yotta_targets
|
||||
yotta_modules
|
||||
upload.tar.gz
|
||||
.DS_Store
|
||||
.yotta.json
|
@ -0,0 +1,46 @@
|
||||
# Copyright (C) 2014-2015 ARM Limited. All rights reserved.
|
||||
|
||||
if(TARGET_NORDIC_NRF51822_16K_ARMCC_TOOLCHAIN_INCLUDED)
|
||||
return()
|
||||
endif()
|
||||
set(TARGET_NORDIC_NRF51822_16K_ARMCC_TOOLCHAIN_INCLUDED 1)
|
||||
|
||||
# legacy definitions for building mbed 2.0 modules with a retrofitted build
|
||||
# system:
|
||||
set(MBED_LEGACY_TARGET_DEFINITIONS "NORDIC" "NRF51_MICROBIT" "MCU_NRF51822" "MCU_NRF51_16K" "MCU_NORDIC_16K" "MCU_NRF51_16K_S110")
|
||||
# provide compatibility definitions for compiling with this target: these are
|
||||
# definitions that legacy code assumes will be defined.
|
||||
add_definitions("-DNRF51 -DTARGET_NORDIC -DTARGET_M0 -D__MBED__=1 -DMCU_NORDIC_16K -DTARGET_NRF51_MICROBIT -DTARGET_MCU_NORDIC_16K -DTARGET_MCU_NRF51_16K_S110 -DTARGET_NRF_LFCLK_RC -DTARGET_MCU_NORDIC_16K -D__CORTEX_M0 -DARM_MATH_CM0")
|
||||
|
||||
# append non-generic flags, and set NRF51822-specific link script
|
||||
set(_CPU_COMPILATION_OPTIONS "--CPU=Cortex-M0 -D__thumb2__")
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} ${_CPU_COMPILATION_OPTIONS}")
|
||||
set(CMAKE_ASM_FLAGS_INIT "${CMAKE_ASM_FLAGS_INIT} ${_CPU_COMPILATION_OPTIONS}")
|
||||
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} ${_CPU_COMPILATION_OPTIONS}")
|
||||
#set(CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} --info=totals --list=.link_totals.txt --scatter ${CMAKE_CURRENT_LIST_DIR}/../ld/nRF51822.sct")
|
||||
|
||||
# used by the apply_target_rules function below:
|
||||
set(NRF51822_SOFTDEVICE_HEX_FILE "${CMAKE_CURRENT_LIST_DIR}/../softdevice/s110_nrf51822_8.0.0_softdevice.hex")
|
||||
|
||||
# define a function for yotta to apply target-specific rules to build products,
|
||||
# in our case we need to convert the built elf file to .hex, and add the
|
||||
# pre-built softdevice:
|
||||
function(yotta_apply_target_rules target_type target_name)
|
||||
if(${target_type} STREQUAL "EXECUTABLE")
|
||||
# !!! FIXME: is there an armcc toolchain command that can be used to
|
||||
# do this? (instead of needing binutils' objcopy)
|
||||
add_custom_command(TARGET ${target_name}
|
||||
POST_BUILD
|
||||
COMMAND arm-none-eabi-size ${target_name}
|
||||
# fromelf to hex
|
||||
COMMAND fromelf --i32combined --output=${target_name}.hex ${target_name}
|
||||
# and append the softdevice hex file
|
||||
COMMAND srec_cat ${NRF51822_SOFTDEVICE_HEX_FILE} -intel ${target_name}.hex -intel -o ${target_name}-combined.hex -intel --line-length=44
|
||||
COMMAND srec_info ${target_name}-combined.hex -intel
|
||||
COMMENT "hexifying and adding softdevice to ${target_name}"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
@ -0,0 +1,24 @@
|
||||
;WITHOUT SOFTDEVICE:
|
||||
;LR_IROM1 0x00000000 0x00040000 {
|
||||
; ER_IROM1 0x00000000 0x00040000 {
|
||||
; *.o (RESET, +First)
|
||||
; *(InRoot$$Sections)
|
||||
; .ANY (+RO)
|
||||
; }
|
||||
; RW_IRAM1 0x20000000 0x00004000 {
|
||||
; .ANY (+RW +ZI)
|
||||
; }
|
||||
;}
|
||||
;
|
||||
;WITH SOFTDEVICE:
|
||||
|
||||
LR_IROM1 0x18000 0x0028000 {
|
||||
ER_IROM1 0x18000 0x0028000 {
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_IRAM1 0x20002000 0x00002000 {
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
## yotta Target Description using ARMCC to compile for Nordic nRF51822 16KB device.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "bbc-microbit-armcc",
|
||||
"version": "0.0.1",
|
||||
"description": "Official mbed build target for the microbit, using the armcc toolchain.",
|
||||
"licenses": [
|
||||
{
|
||||
"url": "https://spdx.org/licenses/Apache-2.0",
|
||||
"type": "Apache-2.0"
|
||||
}
|
||||
],
|
||||
"inherits": {
|
||||
"mbed-armcc": "*"
|
||||
},
|
||||
"keywords": [
|
||||
"mbed-target:nrf51822",
|
||||
"mbed-official",
|
||||
"nrf51822",
|
||||
"nordic",
|
||||
"armcc",
|
||||
"microbit"
|
||||
],
|
||||
"config": {},
|
||||
"similarTo": [
|
||||
"nrf51822",
|
||||
"nrf",
|
||||
"nordic",
|
||||
"cortex-m0",
|
||||
"armv6-m",
|
||||
"mbed-classic"
|
||||
],
|
||||
"toolchain": "CMake/toolchain.cmake",
|
||||
"scripts": {
|
||||
"debug": [
|
||||
"valinor",
|
||||
"--target",
|
||||
"NRF51_MICROBIT",
|
||||
"$program"
|
||||
],
|
||||
"test": [
|
||||
"mbed_test_wrapper",
|
||||
"--target",
|
||||
"NRF51_MICROBIT",
|
||||
"$program"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in new issue