We talked about mbed, what characteristics it has, and what information it provides in a previous posting. In this posting, we are going to build a project and program a compile in order to get used to Web IDE (Web Compiler) which is the most important function of mbed.
Generally, you will need hardware for programming. We are going to use WIZnet’s WIZwiki-W7500 an mbed-enabled platform.
- ARM® Cortex™-M0 Core 48MHz
- 128KB Flash memory
- 16KB to 48 KB SRAM
- Hardwired TCP/IP Core (8 Sockets, MII: Medium-Independent Interface)
Create New Project on Program Workspace
Log into mbed.org, then go ‘Develor Site >> Compiler Site’!
- Click “NEW” which located upper left corner of menu of Web-IDE of Compiler Site, then double click New program.
- When Create new program wizard pops up, please set it up
- Platform: Choose the platform you are actually using not just WIZwiki-W7500
- Template: Choose the template examples supported by each platform
- Program Name: Able to change the Program Name (Following picture is 0_mbed_blinky alternation of mbed blinky)
- Update check box: Already checked on Default. It means newly updated Library is applied when it imports.
- Click OK button after setting to operate an import with Compiler Site.
- Check if 0_mbed_blinky program is created in Web-IDE of Compiler Site. Also, check if 0_mbed_blinky that was set on Create new programwizard exists in Program workspace page.
Let’s take a look on codes and programs before a compile.
- 0_mbed_blinky program consists of main.cpp and mbed.lib.
- 0_mbed_blinky/main.cpp: main() implemented file
- lib: mbed library includes Hardware Adaptation Layer(HAL) of various Peripheral and CMSIS of MCU that are ARM mbed enabled. Therefore, new program needed to be included as Default. Though a source code cannot be approved since it is in a library form, mbed library can be defined as code levels by searching mbed-src on Code Site. But, mbed-src is beta version for now. (mbed.lib is a safe version)
- Look into main.c
- To apply mbed.lib, #include “mbed.h” is inevitable for first line
- Class or API is referred in Handbook Site.
- This example infinitely repeats LED1 On and OFF for 0.2sec each.
- Click one of Web-IDE menu call Compile.
- Download Bin file after a compile is completed without an error.
- Bin’s file name is created as a form of Program Name.Platform Name.bin.
- An mbed platform is read as a drive (mbed) as shown in a following picture. Therefore, you need to program it by copying downloaded Bin file into mbed drive.