Friday, October 4, 2013

Develop ARM Cortex-M on Mac OSX

  I have a Maple-MINI, but I couldn't download a sketch to the board. I found a way to compile codes and flash the binary file onto STM32F103 micro-controller. All I needed were two things: gcc and maple-mini-bootloader source code.

Okay... I didn't plan on making a tutorial, but here it is.

If you are using other venders' arm cortex-m, you can follow my tutorial from step1 to step3.

Here is my procedure:

  1. First, install binary gcc                                        (Yagarto or arm-none-eabi)[*]
  2. Hold on a minute.                                               (edit .bash_profile)
  3. Now, it is time to compile some serious stuff      (maple-mini-bootloader)
  4. Wire it!                                                                (ftdi chip)
  5. Flash it!                                                               (stm32load.py)
[*] I think Yagarto and arm-none-eabi are the same :b




1. First, install binary gcc
  If you want to use Yagarto then go to here and click "YAGARTO GNU ARM toolchain" on the download section. Click resent folder (at the time: 20121222). Download the .dmg file. It took about 1 to 2 minutes for me. Next, open the .dmg file. Read and agree whatever on the screen. You will see yagarto app. Copy this file to desired location. In my case: $(HOME)/Developer/Yagarto/. Double click to install binary gcc in that folder. If you look inside the folder, you will find arm-none-eabi toolchain. Now you have arm gcc.

"But wait, I can't use arm-none-eabi-gcc!"

2. Hold on a minute. 
  PATH must be added, otherwise absolute path must be used.
Edit "~/.bash_profile". This file is similar to "~/.bashrc" in linx. Add this to new line:
export PATH=$PATH:"$HOME/Developer/Yagarto/yagarto-4.7.2/bin"

3. Now, it is time to compile some serious stuff.
  Download mini-bootloader (zip file can be downloaded from lower right hand side of the page).
Unzip to desired location. Open up a new terminal then go to the directory. Simply, type:
make

4. Wire it!
  UART is used in this process. This means you will need something like ftdi chip.
here is how wiring is done:

maple-miniftdi
vcc3v3
gndGND
boot1GND
rx1TXO
tx1RXI

Press two buttons, then release reset button. The maple-mini is in boot mode, now.
Oh, you can release the other button, too ;)


5. Flash it!
  The loader is in the "flash" folder in the project. Type like this on terminal(replace [xxx]):
python flash/stm32loader.py -evw -p /dev/tty.usb[xxx] build/maple_boot.bin
Press the reset button on the button to start your program.


Well?
Get crazy, and have FUN( )

No comments: