sw4stm32 basic function and printf not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-09 3:12 AM
Hi, I'm beginner and I started by a blink project using SW4STM32 along with STMCubeMx libraries set up for my board which is the STM411RE board.
It works well using the following lines in the main while loop:
HAL_GPIO_TogglePin(LD2_GPIO_Port,LD2_Pin);
for(int i=0;i<14200000;i++);but It doen't work when I tried to replace the for statment: for(int i=0;i<14200000;i++); by a function declared above the main{}
like:
void tempo(void){
for(int i=0;i<14200000;i++);}This is really simple but I'm stuck here.
I got another problem with the printf statemenent that doesn't do anything. Don't know if this is correlated to it but it seems that there is something wrong on the configuration of Eclipse or missing I guess.
ps: I have include stdio.h on top of the program.
Thanks for your help
#sw4stm32-eclipse- Labels:
-
SW4STM32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-09 9:24 AM
Yes Sirma, I used Stm32CubeMx to generate the code and the code works (led is blinking) if I only place the following statement in the main{} > while loop:
While(1){
for(int i=0;i<14200000;i++);
HAL_GPIO_TogglePin(LD2_GPIO_Port,LD2_Pin);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-09 9:30 AM
Hello,
Instead of writting HAL_GPIO_TogglePin(LD2_GPIO_Port,LD2_Pin);
could you try HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5); ?
Kind regards
Sirma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-09 9:42 AM
For the printf problem, you have to add some shim code.
Read this:
http://embedded.fm/blog/2016/12/13/discovery-uarts-part-3-the-final-step
Andrei.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-09 10:54 AM
Ok, Upgraded to 1.13.1 then changed the Linker flags to-> -specs=nosys.specs -specs=nano.specs -specs=rdimon.specs -lc -lrdimon
Still no 'hello world' on the console after running the program.
Instead I got these log messages:
** Programming Finished **
** Verify Started **stm32f4x.cpu: target state: haltedtarget halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000verified 8220 bytes in 0.784075s (10.238 KiB/s)** Verified OK **** Resetting Target **Info : Unable to match requested speed 2000 kHz, using 1800 kHzInfo : Unable to match requested speed 2000 kHz, using 1800 kHzadapter speed: 1800 kHzshutdown command invoked- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-09 11:34 AM
Ok. I check that and I'll get back to you soon.
Thanks you all
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-09 11:35 AM
Yes It's the same...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-10 3:28 AM
Hello
lievre.gilles
,> changed the Linker flags to-> -specs=nosys.specs -specs=nano.specs -specs=rdimon.specs -lc -lrdimon
Is only the first step of the procedure.
Please confirm you have followed the full tutorial.
Olivier
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-12 9:56 AM
Ok It finally works even though there is no syscalls.c file in my project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-12 1:31 PM
Nice blog! I read all of it.Great Info. Do you mean it'll works for the SW4STM32 IDE as well since it uses also GCC compiler? Have you ever tried this IDE?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-12 4:12 PM
excellent background music to work to:
https://www.youtube.com/watch?v=8qrhRtjFlpo
(moby seems a little slow)
