Im a bit Lost here ( NEW USER / DEVELOPER )

Post here first, or if you can't find a relevant section!
javier
Posts: 9
Joined: Fri Nov 05, 2021 3:30 pm
Answers: 1

Im a bit Lost here ( NEW USER / DEVELOPER )

Post by javier »

Electronics dark wizards i summon you!

I want to start developing(not just using) code with stm32duino. :!:

I do have some years experience using baremetal STM32 and i would love to port some of my libraries to work with stm32duino.
At the moment im lost i know nothing about the core architecture inside stm32duino.
I have no idea of what is happening under the hood or where to look for it.

I took a look at the github page (stm32 cores) and im nowhere closer to understand....

So any tips, pointers or advice? :ugeek:
aaaaaaa.png
aaaaaaa.png (11.83 KiB) Viewed 3069 times
by javier » Sun Nov 07, 2021 10:13 pm
Jeeeesus that is exactly what i was looking for, sorry for all the fuzz.
Sometimes is hard to articulate what you dont understand yet.

Now i just need to look inside that premain()
I think i can work from here, thanks for your patience
main.PNG
doll poop.jpg
hw_config.png
Things initialised automatically before setup() by arduino that i know of :
  • HSE 8Mhz xtal and internal clocks
  • USB device if chosen in Tools/USB support:
Go to full post
Last edited by javier on Sun Nov 07, 2021 12:09 pm, edited 1 time in total.
hobbya
Posts: 49
Joined: Thu Dec 19, 2019 3:27 pm
Answers: 1

Re: Im a bit Lost here :(

Post by hobbya »

There are quite many users who don't know how to operate their new devices or gadgets because they don't read the manuals out of their excitement.

On the front page of this forum there is a section: NEW USERS START HERE ......
javier
Posts: 9
Joined: Fri Nov 05, 2021 3:30 pm
Answers: 1

Re: Im a bit Lost here :(

Post by javier »

Sorry but i cant find the section " NEW USERS START HERE "
Maybe its because im not familiariced with the forum structure?

Also, my daywork is to read manuals, im not afraid of reading thisone once i find it
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Im a bit Lost here :(

Post by ag123 »

well, the STM core wiki is here
https://github.com/stm32duino/wiki/wiki
the repo is here
https://github.com/stm32duino/Arduino_Core_STM32

you can find some FAQs here:
viewtopic.php?f=2&t=3
viewtopic.php?f=2&t=301

And do state your board and MCU that you are 'playing' with. You can find a list of 'supported' boards on the core GitHub repo

A 'hello world' for '*duino' stuff is to blink a/the LED.

e.g.

Code: Select all

int led_pin = LED_BUILTIN;

void setup() {
	pinMode(led_pin, OUTPUT);
}

void loop() {
	digitalWrite(led_pin, ~ digitalRead(led_pin) & 1U);
	delay(1000);
}
javier
Posts: 9
Joined: Fri Nov 05, 2021 3:30 pm
Answers: 1

Re: Im a bit Lost here :(

Post by javier »

thanks @ag123 , just what i was looking for. ;)
Now i have lecture for weeks.

>And do state your board and MCU that you are 'playing' with. You can find a list of 'supported' boards on the core GitHub repo
I own several nucleo/discovery boards

>A 'hello world' for '*duino' stuff is to blink a/the LED.
Im a bit past that point but thank you!
I dont want to get started, want to understand the strings moving the puppet
Last edited by javier on Fri Nov 05, 2021 4:17 pm, edited 1 time in total.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Im a bit Lost here :(

Post by ag123 »

If you know stm32 (as in developed in it prior) and really want to jump in the deep end, you can take a look at the codes in the variant and core after you have got it installed. The initializations etc are all done there so that the codes in the sketch looks apparently simple, i'd guess it is a reason Arduino / Wiring concept is popular.

oh and in the wiki link above do take a look at the API section. those include some 'duino' extras that's specific to stm32 (they may be based on similar api elsewhere but is 'ported' to stm32, or they could be unique and their own, e.g. the hardware timers, I'm not sure if that is after all an 'Arduino' API, but it is here in stm32(duino(s)) - including an 'old' one called 'libmaple' core).
Last edited by ag123 on Fri Nov 05, 2021 4:24 pm, edited 1 time in total.
javier
Posts: 9
Joined: Fri Nov 05, 2021 3:30 pm
Answers: 1

Re: Im a bit Lost here :(

Post by javier »

> really want to jump in the deep en
i want to know what and how is the Arduino code sandwich doing its magic (i only know HAL based baremetal C programms)

> The initializations etc are all done there,
Thanks,exactly what i am looking for , ill look into that .

> i'd guess it is a reason Arduino / Wiring concept is popular.
Arduino's appeal for me is about the huge community supporting open source libraries.
everything hidden under the hood is a drawback for me.

>oh and in the wiki link above do take a look at the API section.
This is also interesting but, i would like to do my own custom APIS (a board specific neopixel pwm+dma driver for example)






___________________

I found the startup code for my f4 board inside C:\Users\*******MYUSER******\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\system\STM32F4xx

I read here https://github.com/stm32duino/wiki/wiki ... figuration i could create my own custom initialisation by adding
hal_conf_custom.h
In my sketch folder
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: Im a bit Lost here :(

Post by mrburnette »

javier wrote: Fri Nov 05, 2021 4:24 pm > really want to jump in the deep en
i want to know what and how is the Arduino code sandwich doing its magic (i only know HAL based baremetal C programms)

> The initializations etc are all done there,
Thanks,exactly what i am looking for , ill look into that .

> i'd guess it is a reason Arduino / Wiring concept is popular.
Arduino's appeal for me is about the huge community supporting open source libraries.
everything hidden under the hood is a drawback for me.

>oh and in the wiki link above do take a look at the API section.
This is also interesting but, i would like to do my own custom APIS (a board specific neopixel pwm+dma driver for example)

I must have written this post dozens of times, rather than just wasting digital-landscape, here is a link to a summary:
viewtopic.php?p=6686#p6686
> i'd guess it is a reason Arduino / Wiring concept is popular.
Arduino's appeal for me is about the huge community supporting open source libraries.
everything hidden under the hood is a drawback for me.
IM(H)O: Just about the "worst" reason possible to jump into the Arduino waters. Libraries are of various "quality" and range between inspired-by-God and developed by a zombie. Many libraries are just mediocre and uninspired. Worst, some are not OOP libraries at all, but just a function with a header file.

If you are proficient with HAL and are well versed in the STM32 ecosystem, time spent with Arduino is best confined to research for a book or publication on the Arduino concept.

What you may find enlightening and fun is: https://processing.org/

Ray
javier
Posts: 9
Joined: Fri Nov 05, 2021 3:30 pm
Answers: 1

Re: Im a bit Lost here :(

Post by javier »

I must have written this post dozens of times, rather than just wasting digital-landscape, here is a link to a summary:
viewtopic.php?p=6686#p6686
Thanks, ill give it a good read. Usefull stuff.
I am afraid you might have to post it a dozen times more, because my experience as new user as i searched around this forum "new user" or "guetting started developing" was only getting results about how to blink your PC13 led in you bluepill board.
IM(H)O: Just about the "worst" reason possible to jump into the Arduino waters. Libraries are of various "quality" and range between inspired-by-God and developed by a zombie. Many libraries are just mediocre and uninspired. Worst, some are not OOP libraries at all, but just a function with a header file.
:lol: the zombie part cracked me.
After a couple of years of full time developing HAL baremetally im done reinventing the wheel every time (even if it works like a charm).
Im tired of implementing filesystems as a one man army, i end up not having time to deliver any real solution.

I am well aware of libraries poorly maintained or dependencies ratnests, but is better than nothing.
If the arduino libraies or community support doesnt cut it for me i could always debug their code (this is why i want to know how/where the arduino CLI scripts magic is gluing code together) or go back to code stuff by myself.
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: Im a bit Lost here :(

Post by mrburnette »

javier wrote: Sun Nov 07, 2021 12:02 pm ...
If the arduino libraies or community support doesnt cut it for me i could always debug their code (this is why i want to know how/where the arduino CLI scripts magic is gluing code together) or go back to code stuff by myself.
Well, that makes all the difference ...

https://arduino.github.io/arduino-cli/0 ... d-process/

The IDE is really a big mess of JAVA code with each installation containing the JAVA interpreter and has its own classpath. Much of the hardware and software parameters are in two configurable files which you can read about in the above link.

Most 3rd party libraries work; they may break between different uC architectures; casting issues and INT size is often a problem.

May I suggest, always bring in the library code to use into the project folder and change the #include from <file> to "./file" then those .h and .cpp files will appear in the IDE. You can whack the heck out of the files to enhance/customize them to your will. Also, a ZIP of the project folder is complete with no Arduino/libraries dependencies. The IDE overwrites library and board files on over-the-air updates.

Have fun. You may find this interesting: https://www.arduino.cc/pro/cli

user ag123 has a series of posts on using makefiles with Arduino.
javier wrote: Sun Nov 07, 2021 12:02 pm I am afraid you might have to post it a dozen times more, because my experience as new user as i searched around this forum "new user" or "guetting started developing" was only getting results about how to blink your PC13 led in you bluepill board.
I'm old and only have a finite number of characters left, so that may or may not happen. Actually, my forum activity here has diminished considerably over the last two years as the forum (and interests) moved away from the LeafLab's original STM32 core-code, to the Arduino compatible monolithic codebase maintained by Roger Clark, to the current ST Corporate sponsored version based on HAL and CMSIS. My interests are diverse and I find myself with less time to devote to working forum questions here. But, the forum has numerous members with great knowledge.

As a software person, you may find some old, hardware Arduino implementation good background material: http://gammon.com.au/forum/bbshowpost.p ... pic_id=123

Ray
Post Reply

Return to “General discussion”