MEAM.Design - M4 - Getting Started in Windows



Install ARM GCC Compiler binaries

1. Install the GCC-ARM-Embedded Binaries for Windows from here

2. Download and install GNU Make for Windows

3. Right click "My Computer" and select Properties.

4. Click "Advanced system settings"

5. Click on the tab named "Advanced"

6. Click "Environment Variables"

7. Click New (user variables) and enter this parameters:

Variable name: PATH

(64-bit systems) Variable value: C:\Program Files (x86)\GnuWin32\bin;C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2012q4\bin

(32 bit systems) Variable value: C:\Program Files\GnuWin32\bin;C:\Program Files\GNU Tools ARM Embedded\4.7 2012q4\bin

8. Press OK on all windows till everything gets closed.

Install DfuSe Demostrator from ST

1. Install DfuSe Demonstrator

OR

Install dfu-util (preferred)

1. Download the zip file and extract all the files to the template code folder "m4Template" that you will download in the next step.

2. Run zadig.exe from the extracted files.

3. Click Device Menu and choose Load Preset Device and select the file m4_driver.cfg

4. Make sure the driver listed just above the Install button is WinUSB

5. Click Install

6. Plug in the M4 board to the computer now (if it was already connected then remove and connect it again)

Compile Source Code

1. Download the template code which contains all the libraries. (Note if you have Green M4 edit the Makefile and change -DM4_WHITE to -DM4_GREEN)

2. Place your source files (*.c) in "m4Template/src" folder OR "m4Template" folder

3. Place your header files (*.h) in "m4Template/inc" folder OR "m4Template" folder

4. Navigate command prompt (cmd) to m4Template folder and execute: (when compiling first time or library is getting compiled it takes about 2+ minutes on Windows so be Patient!)

	make

5. Last line should look something like

	[>--BinaryGenerated--<]

Upload your code

1. Connect the microcontroller to the computer, hold the onboard button until the Orange LED is on (about two seconds), then release it.

2. Follow the steps to download the file to the board explained in detail in this pdf.

OR

(preferred)

1. Connect the microcontroller to the computer, hold the onboard button until the Orange LED is on (about two seconds), then release it.

2. Execute the following in terminal

	make flash

3. Last lines should read

	[>--^--M4 Loaded--^--<]

Running your code

1. Tap the onboard button for less than two seconds, the orange LED should turn off, and your code should run.

Note:

You can also call make with following arguments

	make clean -- cleans all the object files of user source files 
	make cleanlib -- cleans all object files of the library and user source files
	make flash -- upload code using USB DFU Bootloader
	make disassemble -- generates .dis and .dmp file for debug purposes