-
Notifications
You must be signed in to change notification settings - Fork 38
Quick Start Guide
You need a *nix-style development environment, such as linux with the minimal packages to get GNU make
or OS X with XCode Command-line Tools installed. (MinGW may work as well, but isn't currently tested or supported. Any help with testing and cleaning this part up would be greatly appreciated.)
For ARM development, the gcc-arm-embedded tools are available for OS X, Linux, and Windows. For OS X and Linux, these tools will be automatically downloaded and installed in a git-ignored directory in the Motate repo if they aren't found in the path. For windows, you will have to download and install them ahead of time.
-
Clone the Motate git repo or download the zip.
-
Create a new folder in the
MotateProject/demos/
directory with the name of your project, such as:AwesomeProject
. -
In your
AwesomeProject
folder, create a file calledAwesomeProject
.cpp
-- the key being the.cpp
ending -- with the following contents:
#include "MotatePins.h"
#include "MotateTimers.h"
#include "MotateUART.h"
// Create an output pin on kLED1_PinNumber
Motate::OutputPin<kLED1_PinNumber> led1_pin;
// This creates an 8N1, 115200-baud serial connection
Motate::BufferedUART<> serialPort {115200};
void setup() {
// Initialize the pin to 1, or high.
led1_pin = 1;
}
void loop() {
// Flip the output from high ->low, or low -> high
led1_pin.toggle();
// Tell the world (or who ever is listening on the serial connection) about it:
serialPort.write("Awesome Project -- it toggles an LED then writes over the UART about it!\n");
// Pause for 1/4 second -- 1 second == 1000
delay(250);
}
- Next to
AwesomeProject
.cpp
, create afile with this exact nameMakefile
and these contents:
PROJECT = AwesomeProject
# Adjust this if you move the AwesomeProject folder:
MOTATE_PATH ?= ../../motate
NEEDS_PRINTF_FLOAT=0
include $(MOTATE_PATH)/Motate.mk
- Choose what board you would like to deploy this project to. (Usually, you should choose earlier than this. ;-) In this simple example we will use the FRDM-KL05Z board from Freescale (usually available for under $15US from various retailers) that has been MBED-enabled to provide a nice drag-and-drop interface to program the board.
- Thanks to the excellend bootloader and debugger work by the MBED team!
- Other than the use and appreciation for the MBED CMSIS-DAP tool, Motate and MBED are not related. (Well, internally Motate *does* use some CMSIS files that were other wise difficult to obtain. Again, we are very thankful to the MBED team.)
- At a command line, cd into the
AwesomeProject
directory, and issue the following command:
make BOARD=FRDM-KL05Z
The first run might take a while as it downloads and decompresses the tools for your platform.
- Now, in the
AwesomeProject/bin/FRDM-KL05Z/
folder is a file calledAwesomeProject.bin
-- just drag or copy that file to the MBED drive. The MBED drive should unmount (OS X will issue a nasty-sounding warning that can safely be ignored) and remount.
Hit the reset button on the FRDM-KL05Z board, and the red LED should start to blink. If you connect to the serial port device using a terminal emulator like CoolTerm or screen
(at 115200, 8N1) you should see the text spit out at the same timing as the blink.