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-12 4:40 PM
Thanks, it's good to know someone is reading it.
Yeah, yeah, if you read back a few more dozen entries, I go into (I think it's in the intro to C posts) the various compilers that play well with Cube and give my rationalization as to why I chose SW4STM32 for teaching my Embedded Wednesdays class at the local hacker space. For my blog I tend to use SW4STM32 for the examples because going from Cube to running is a 2 minute proposition.
In my Supeman life I use RTEMS and GCC. The RTEMS people have put together a really sweet version of the newlib system including all of the UNIX 'canonical' terminal I/O (read cooked mode) that does all of the backspace handling and stuff and it works SOOOOOO well.
In my Clark Kent life, teaching at the Edmonton New Technology Society, I needed something to get people up and running for zero cost that runs on Macs, Linux, and unfortunately, Windows, and SW4STM32 won.
I'd consider using it at work when I'm putting together a little system that runs bare metal and doesn't require an RTOS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-12 4:42 PM
Thanks for the pinter, I'm listening to that track right now. I'm finishing up a blog post on DMA (targeted at intermediate/advanced embedded people) and I don't have a soundtrack yet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-12 4:54 PM
Hmm, vocals at 22 minutes. Unfortunately that is how you break someone's flow. I'll keep listening though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-12 4:58 PM
this one grows on you... must have listened to it 100 times...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-04-10 11:53 AM
Does this semihosting feature works the same way as using printf with ITM/SWO?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-05-29 10:41 AM
Your printf goes nowhere. You have to redirect it to UART1:
// redirection of printf
void _write(int file, char *ptr, int len){ int i; for (i = 0; i < len; i++) { HAL_UART_Transmit(&huart1, (uint8_t*) &ptr[i], 1, 10); }}The printf has to be closed with a \n
Search youtube for getting started with CubeMX

- « Previous
- Next »