The Godfather talking
This is god damn my place! Capisci?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 10:46:00 10:46


Login with username, password and session length


Pages: [1]
Print
Author Topic: Simple blink application can not build...  (Read 13422 times)
0 Members and 1 Guest are viewing this topic.
MicroBox
Junior Member
**
Offline Offline

Posts: 35

Thank You
-Given: 11
-Receive: 0


« on: April 09, 2012, 01:45:02 13:45 »

 Hi experts,
I have a STM32 Value Discovery Kit(STM32F100RBT6B) today and just installed Keil ARM MDK 4.50. I'm new to ARM, can anyone help me how to open a blinky project and load it to the devboard kit, I appreciate any guide or link on how to go about.
I tried to open a blinky project and try to click on the load button...
this is the code I use.
Code:
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_lib.h"

/* Macro Definitions ------------------------------------------------------------------*/
#define LED_REGISTER GPIOC
#define LED1    GPIO_Pin_8 //PC8

//See stm32f10x_gpio.h for more info
#define OUTPUT_MODE_PP (GPIO_Mode_Out_PP)// push-pull
#define OUTPUT_SPEED_50MHZ (GPIO_Speed_50MHz)//50MHz

/* Private Variables ------------------------------------------------------------------*/

/* Prototypes ------------------------------------------------------------------*/
void GPIO_Configuration(void); //Initialize GPIO
void delay(unsigned long count);


int main(void)

/* Initialize Peripherals */
GPIO_Configuration();

  /* Infinite loop */
  while (1)
  {
  // set pin high
    GPIO_SetBits(LED_REGISTER, LED1);
    delay(0x3D0900);
 
// set pin low
    GPIO_ResetBits(LED_REGISTER, LED1);
    delay(0x3D0900/*0x4C4B40*/);    
   
  }
}

void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure; //Create Structure for GPIO

/* Enable Peripheral Clock */


RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);   

/* set pin output mode */   
    GPIO_InitStructure.GPIO_Pin = LED1;
    GPIO_InitStructure.GPIO_Mode = OUTPUT_MODE_PP;
    GPIO_InitStructure.GPIO_Speed = OUTPUT_SPEED_50MHZ;
    GPIO_Init(LED_REGISTER, &GPIO_InitStructure);
}

void delay(unsigned long count)
{
    while(count--);
}
/* End of Project ------------------------------------------------------------------*/
Please see attached file for the result 'm having trouble.

Thanks in adavance,
microbox
Logged
IntelGent
Junior Member
**
Offline Offline

Posts: 37

Thank You
-Given: 12
-Receive: 53



« Reply #1 on: April 09, 2012, 02:56:55 14:56 »

Possibly this.... #include "stm32f10x_lib.h"?

In your error box, it says Could not load file C:\STM32_Applications\LED\Blinking\Obj\STM3210x_Apps.AFX

Of course I'm just guessing a filename typo, but hopefully I'm right and this helps.
« Last Edit: April 10, 2012, 01:18:29 01:18 by IntelGent » Logged
ppa88
Active Member
***
 Muted
Offline Offline

Posts: 200

Thank You
-Given: 49
-Receive: 131


« Reply #2 on: April 09, 2012, 03:26:50 15:26 »

To me it looks as if the .axf file has not been created. Are you sure this file has been created in the obj folder ? The hex file for download is created from the .axf file by using the fromelf.exe program. It will be better if you upload  a picture which shows your build output.
« Last Edit: April 09, 2012, 03:30:09 15:30 by ppa88 » Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #3 on: April 09, 2012, 03:40:47 15:40 »

Look at this, might be useful:

http://en.radzio.dxp.pl/stm32vldiscovery/lesson1,first,program,blinking,leds.html
Logged
kukumar
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 29
-Receive: 28


« Reply #4 on: April 10, 2012, 07:58:09 07:58 »

There is some bug in keil ...  FLASH-Download  is not working , I must use Debug button to download program!

Posted on: April 10, 2012, 08:54:39 08:54 - Automerged

copy" stm32f10x_lib.h" in working folder (in folder where is yours program)
Logged
MicroBox
Junior Member
**
Offline Offline

Posts: 35

Thank You
-Given: 11
-Receive: 0


« Reply #5 on: April 10, 2012, 11:52:34 11:52 »

Thanks for your response everyone, I followed the tutorial in the link given by metal. But I'm still having trouble loading it to the device...
Please  see attached file for the result.

Thanks again,
microbox
Logged
kukumar
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 29
-Receive: 28


« Reply #6 on: April 10, 2012, 12:25:06 12:25 »

try: keil/arm/boards/ST/stm32-Discovery/Blinky

there is sample .

Did you set : ST-Link Debuger   
        settings: SW
Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #7 on: April 10, 2012, 12:33:40 12:33 »

The warning is because your file has not a new line after the last line of code. This means you have got 0 errors and 0 warning. I am waiting for my STM discovery as well...

I found this while searching, might help you, or might help kukumar:
http://www.keil.com/support/docs/3547.htm

I saw someone like you:
Quote
Hi!

I just started using the STM32F4 discovery board with Keil development environment, and I have a small problem, that I can not program the flash memory of the microcontroller using the Load button. In Keil Build output window, there is no error message, just one line saying:
Load "C:\\Keil\\ARM\\Boards\\ST\\STM32F4-Discovery\\Blinky\\Flash\\Blinky.AXF"
But then nothing happens, LD1 on board lights up green for a split second, and it turns then red again, and the microcontroller stays in a kind of turned off state, until I press reset button. And then it continues the original program.

However when I push the Debug button it automatically updates the flash memory, so flash programming is working, and is available, it is just confusing, that if I want to download the program in microcontroller I always have to start, and end the debug session.

What am I doing wrong?

Once you read it, try this page:
http://arm4fun.com/index.php?option=com_content&view=article&id=7:how-to-used-st-link-utility-to-download-hex-file-from-keil-uvision&catid=1:2010-07-22-17-08-36&Itemid=4&lang=en

I think your problem will be solved. May be your problem was setting the correct debugger and the mode, but still when you read that page, you will find interesting stuff as well.
Logged
MicroBox
Junior Member
**
Offline Offline

Posts: 35

Thank You
-Given: 11
-Receive: 0


« Reply #8 on: April 10, 2012, 11:41:20 23:41 »

Hi, I'm still having no luck loading the program to the board, I attached some screen shots of my settings...that might pinpoint my issues.
From this link http://arm4fun.com/index.php?option=com_content&view=article&id=7:how-to-used-st-link-utility-to-download-hex-file-from-keil-uvision&catid=1:2010-07-22-17-08-36&Itemid=4&lang=en
Where can I download ST-Link Utility V.2?

regards,
microbox
Logged
kukumar
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 29
-Receive: 28


« Reply #9 on: April 11, 2012, 03:59:53 15:59 »

first... go to the end of yours program- (cursor) and pres ENTER
This is for eliminate warning...

then open st-link settins and you will see if yours target is there or no...
(I hope you have 2 jumpers on board for programmings)

If there is no solution then:
If you open new existing project (ST board in keil ) and load it ... all must be ok and you can debug program..All settings is there.
I suggest use new keil program for arm.
Logged
kukumar
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 29
-Receive: 28


« Reply #10 on: April 11, 2012, 06:40:29 18:40 »

ST_link software:

st-link_usbdriver.zip, st-linkUpgrade.exe, stlinkusbdriver.dll

http://www.st.com/internet/evalboard/product/219866.jsp
Logged
h0nk
Senior Member
****
Offline Offline

Posts: 256

Thank You
-Given: 207
-Receive: 230



« Reply #11 on: April 11, 2012, 11:40:04 23:40 »

First You should install the appropriate driver for ST-Link.
You will find the USB-driver in: {MDK-installdir}\STLink\USBDriver as ST-Link_V2_USBdriver.exe

And You should enable the emulator (and not the simulator) in Your settings. :-)

Hope this helps.

Best Regards

« Last Edit: April 11, 2012, 11:43:34 23:43 by h0nk » Logged
MicroBox
Junior Member
**
Offline Offline

Posts: 35

Thank You
-Given: 11
-Receive: 0


« Reply #12 on: April 12, 2012, 04:56:30 16:56 »

Thanks everyone for your support, I did managed to install the USB driver(ST-Link_V2_USBdriver) from C:\Keil\ARM\STLink\USBDriver and selected the emulator. But I'm still getting an error.
Code:
Build target 'Target 1'
linking...
Program Size: Code=860 RO-data=320 RW-data=20 ZI-data=1636  
FromELF: creating hex file...
"MyBlink.axf" - 0 Error(s), 0 Warning(s).
""
--- Error: failed to execute '"" '
""
--- Error: failed to execute '"" '
What do you think I'm still missing?

Thanks again,
microbox
« Last Edit: April 12, 2012, 05:08:22 17:08 by MicroBox » Logged
h0nk
Senior Member
****
Offline Offline

Posts: 256

Thank You
-Given: 207
-Receive: 230



« Reply #13 on: April 13, 2012, 07:03:27 19:03 »


Hello microbox,

some remarks:
- there is no need to create a hex file
- there is no need to use an external flash utility

It seems, that are some unnecessay build steps in Your project.
Check the user tab of Your project options. All fields should be empty.

Run the program ${mdk-installdir}\ARM\STLink\ST-LinkUpgrade.exe
The firmware version should be reported as: V2.J15.S0 JTAG Debugger
In this directory You will also find a log report of the driver: error.log.
Code:
...
STLinkUSBDriver.dll loaded
ST-Link/V2 device detected
Target voltage detected: 2.895868
**** End of GDI DUMP ****

The new st-link driver needs some configuration. The attached picture shows this for a STM32F407VG.
So Your input/output may vary.

If You run into problems, try: ST-Link (Depracated version) and configure SWD.

Good luck.


Best Regards
Logged
MicroBox
Junior Member
**
Offline Offline

Posts: 35

Thank You
-Given: 11
-Receive: 0


« Reply #14 on: April 14, 2012, 09:09:24 09:09 »

Thanks, my very first ARM program now works Smiley
BTW this is the firmware version I have V1.J12.S0 JTAG Debugger.

regards,
microbox
« Last Edit: April 14, 2012, 09:14:51 09:14 by MicroBox » Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


« Reply #15 on: May 07, 2012, 02:00:54 02:00 »

I'm on my first weeks play with Arm devices, first thoughts are there is not a lot of examples, that show you how to do it.
even the data sheets are spilt,so you need 2 or more, just to set up device.

I'm using Keil (how I wish they had off line help sheets) with ulink2, and or a jlink programmer, the steps you have to follow to compile then flash the chip, are very complicated, toolpath and folders seems to be critical, even looking at samples folder the
same sample code is repeated for every demoboard, and chip.
This was showing up the same errors as above, plus other ones too.

When I got every thing set right, using demo code was a lot easier, knowing where to place your work in the toolpath.
Now all I need to learn is C++  and how to use te ports  in the arm devices.
 
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #16 on: May 07, 2012, 09:33:59 09:33 »

PICKit, I have an LPC2138 small demo board, when I first tried to find a blinky example, I searched for the datasheet, thinking that I am searching for ATmega datasheet, then I discovered that in the ARM world, they call it LPC2138 user manual.

When I found the code, I found with it a snapshot that shows how to configure startup.s in keil, this is a cool feature in keil indeed, I had hard time making anything run with the free toolchains, they needed startup linker files which I don't know how to write.

I am planning to write a kick start tutorial for keil and crossworks ARM, but I have got a project on hand that I must finish before I return back to ARM.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC