This recipe will detail modifications that are necessary for the Blinky program created by the Eclipse project wizard and will show how to use the MDK-ARM Eclipse plug-in to flash the STM32F407IG part. We'll call this recipe GNU_ARM_Blinky_c9v0
.
BlinkLed.c
; in the blink_led_int()
function, search for the following statement:GPIO_InitStructure.Pull = GPIO_PULLUP;
Replace this statement with the following one:
GPIO_InitStructure.Pull = GPIO_PULLDOWN;
BlinkLed.h.
Replace the STM32F4DISCOVERY
definitions with the following:// MCBSTM32F400 Eval. Board defs (led G6, active high) #define BLINK_PORT_NUMBER (6) #define BLINK_PIN_NUMBER (6) #define BLINK_ACTIVE_LOW (0)
We've simply configured the U-Link as a device programmer in this recipe. If you find that this doesn't work, then refer to http://www.keil.com/support/docs/3061.htm. Copy the .hex
file created by Eclipse to a uVision project and use uVision to flash the board. You may need to use the UL2_EraseFW.exe
utility that we discussed in Chapter 2, C Language Programming. If you do erase the U-Link firmware and subsequently flash the board using Eclipse, then expect the following to appear in the uVision Output Console:
The calls to the trace_printf()
function that appear in main can be ignored (or commented out). They are present to allow text strings to be displayed in the console debug window using a U-Link communication channel; however, although they work with the discovery board emulator, they don't with the U-Link2 hardware. This is not a serious problem because Chapter 2, C Language Programming describes other equally good approaches to debugging code.
You may have noticed that the GPIO support for LEDs provided by the Eclipse wizard is inferior to that in uVision. To drive multiple LEDs, we'll need to adapt some of the functions in the LED.c
uVision file that is part of the Hello_Blinky
project that we encountered in Chapter 1, A Practical Introduction to Arm® Cortex®.
3.144.82.21