From 7e8e6778d72b085c0adcef8a9d81c01f4ff7fdd4 Mon Sep 17 00:00:00 2001 From: James Devine Date: Fri, 14 Aug 2015 17:29:00 +0100 Subject: [PATCH 1/2] microbit-dal: Added readme.md This read me describes the process of getting the microbit environment working with yotta. --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2769a4e --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +# microbit-dal + +## Building a project for the micro:bit using Yotta + +Instead of using the online IDE, Yotta can be used to provide an equivalent offline experience. The current compilers that are available are: + +* GCC +* ARMCC + +## Getting Started + +### 1. Install Yotta +The first step is to get Yotta onto your machine, to do this follow the install guide [here](http://docs.yottabuild.org/#installing) + +**Note: if you are on windows, dependencies will be missed as of 8/8/15, please use the helper script located [here](https://github.com/ARMmbed/yotta/blob/master/get_yotta.py).** + +### 2. Fetch the example project + +If your install has gone correctly, and you have all dependencies installed, the next step is to fetch the example project using the runtime from GitHub. + +``` +git clone https://github.com/lancaster-university/microbit +``` + +**Note: To successfully build this project you will need access to the microbit-dal private repository, if you need access please email me at j.devine@lancaster.ac.uk.** + +### 3. Try to build +Building rarely works first time due to dependencies currently not being installed by Yotta, so the next step is to **try** to build. + +The default yotta target you will receive when you pull the aforementioned repo is bbc-microbit-classic-armcc, you can use the following command to print your current target in Yotta: + +``` +yt target + +bbc-microbit-classic-armcc 0.0.5 +mbed-armcc 0.0.8 +``` + +If you do not have armcc installed (or don't have a license for Keil), then you will need to use GCC. To swap to the GCC target run: + +``` +yt target bbc-microbit-classic-gcc +``` + +Then you should **try** to build using the following command: + +``` +yt build +``` + +For GCC, you will have to swap the CortexContextSwitch.s file with the file CortexContextSwitch.s.gcc which will be located in `/yotta_modules/microbit-dal/source`. For an example of how to do this, look below: + +``` +#first rename the existing one +mv yotta_modules/microbit-dal/source/CortexContextSwitch.s yotta_modules/microbit-dal/source/CortexContextSwitch.s.armcc + +#then rename gcc version so that it is included by cmake +mv yotta_modules/microbit-dal/source/CortexContextSwitch.s.gcc yotta_modules/microbit-dal/source/CortexContextSwitch.s +``` + +This is a temporary measure until Yotta supports assembly preprocessing for armcc. + + +**NOTE: +To build the final hex files for the micro:bit, you will need to install the srec which can be installed via brew (`brew install srecord`), or you can install it manually from [here](http://srecord.sourceforge.net/).** + +### 4. Flash your micro:bit +The final step is to check your hex works. + +The yotta build command will place files in `/build//source`. The file you will need to flash will be microbit-combined.hex. Simply drag and drop the hex. + +The expected result will be that the micro:bit will scroll `BELLO! :)` on its display. From 6e65c33e88f3e69e74cf00986dbd2bf45a90b0e9 Mon Sep 17 00:00:00 2001 From: Jonathan Protzenko Date: Fri, 14 Aug 2015 15:51:16 -0700 Subject: [PATCH 2/2] Expose PinName for PWM purposes. --- inc/MicroBitPin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/MicroBitPin.h b/inc/MicroBitPin.h index 0186e93..edaf844 100644 --- a/inc/MicroBitPin.h +++ b/inc/MicroBitPin.h @@ -61,7 +61,6 @@ class MicroBitPin : public MicroBitComponent */ void *pin; // The mBed object looking after this pin at any point in time (may change!). - PinName name; // mBed pin name of this pin. PinCapability capability; /** @@ -71,6 +70,7 @@ class MicroBitPin : public MicroBitComponent void disconnect(); public: + PinName name; // mBed pin name of this pin. /** * Constructor.