Author Topic: Rant... Why I dumped Platform IO IDE after a week  (Read 17484 times)

0 Members and 1 Guest are viewing this topic.

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #75 on: September 21, 2022, 01:24:39 pm »
I remember looking into doing STM32 development using VSCode about a year ago. There are several sites describing how to do this, and they all require tying together a bunch of bits and pieces from different sources. And they require using STM32CubeMX to create the makefiles. After futzing with it for a week, I finally got things going, but it felt like a kludge that would break anytime one of the components changed and became incompatible with some other component.

On STM32 forum, this link https://devblogs.microsoft.com/cppblog/importing-st-projects-into-visual-studio-code/  just appeared in one of the threads.

It also has one comment.

JW
« Last Edit: September 21, 2022, 01:26:13 pm by wek »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4196
  • Country: us
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #76 on: September 21, 2022, 11:55:13 pm »
I am reminded of when TI released the first "LaunchPad" board as an "Arduino Killer."It came with a nice tutorial on how to set it up:
  • Install the TI compiler.
  • Install the MSP430 libraries.
  • Install the drivers for the programming hardware.
  • Install the launchpad examples.
  •    :
    20. Plug your Launchpad into the USB port of your computer.[/li]
They were ... "not clear on the concept."

But that's GOOD, right?  "Arduino is too easy and doesn't make you learn important skills."
 
The following users thanked this post: thm_w, tooki, newbrain, JohnG, elecdonia

Offline tellurium

  • Regular Contributor
  • *
  • Posts: 226
  • Country: ua
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #77 on: September 22, 2022, 09:47:30 am »
So what is the right solution for this?

Make an arduino-like tool, with bundled toolchain & make for bare metal programming, if current installers/builds are buggy?
Create an online editor/compiler with import/export capabilities?
Or something else?
Open source embedded network library https://mongoose.ws
TCP/IP stack + TLS1.3 + HTTP/WebSocket/MQTT in a single file
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3452
  • Country: it
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #78 on: September 22, 2022, 10:07:22 am »
I am reminded of when TI released the first "LaunchPad" board as an "Arduino Killer."It came with a nice tutorial on how to set it up:

[...] list [...]
They were ... "not clear on the concept."

But that's GOOD, right?  "Arduino is too easy and doesn't make you learn important skills."


microchip came up with a really good alternative with the xpress boards:
the board presents itself as a composite device, VCP and MSD
stdio routed through VCP for printf/scanf
copy hex file to the msd device to initiate programming of the target microcontroller

you can use the mplab xpress cloud ide to write code and download an hex file, a shitton of examples on the web archive (which i used myself from time to time) and you can contribute. you can use mcc to create the application or write bare metal code

or of course install the toolchain if you don't want to use the cloud version, take the hex file and copy to the board. xpress board was really nice and (at first) priced really aggressively
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #79 on: September 22, 2022, 11:17:14 am »
So what is the right solution for this?
There is no one size fits all.

JW
 

Offline jnzTopic starter

  • Frequent Contributor
  • **
  • Posts: 593
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #80 on: September 22, 2022, 06:29:28 pm »
You guys are fucking professionals at going topic-adjacent. If as OP I can chime in...

If you want to be a toolchain expert, or if you want to make tools to make tools, yea go for it. But the sentiment is correct for most of us, we don't want to be toolchain experts. It's not like CMake/Make is hard. It's really not. A little intimidating if all you've ever done is IDE or nothing.

It's taken me a long time to come around it - but GCC + CMake/Make is just a better setup long term- WHEN - coupled with a good environment (notice I didn't say IDE). The lines of IDE are blurred. Is VSCode an IDE? No, but is it an IDE for me as set up? Much Yes.

But the overall point here, the reason for making this post to begin with is that Platform IO or really any IDE once you stray outside developer intentions, you'll be doing the same effort as the toolchain-direct people but in a system that offers fewer options and less support.

Might as well just put your pants on all by yourself like a big boy. Because like it or not, you'll be forced to at some point.
 
The following users thanked this post: Smokey

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3452
  • Country: it
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #81 on: September 22, 2022, 07:00:35 pm »
You guys are fucking professionals at going topic-adjacent. If as OP I can chime in...

Rule 25. Relation to the original topic decreases with every single post.
But not really, it started as why PIO sucks completely and the discussion moved to why some need it, then to why the pro way is actually easy (or not), then to alternatives
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #82 on: September 22, 2022, 08:36:50 pm »
But the overall point here, the reason for making this post to begin with is that Platform IO or really any IDE once you stray outside developer intentions [...]
What were/are PIO developer intentions? And did they fail to accomplish them, or just they missed your expectations? In any case, how would you know without trying?

Thanks again for sharing your experience.

JW

PS. Make is hard to me. I don't use anything other, so I don't know CMake.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14313
  • Country: fr
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #83 on: September 22, 2022, 08:41:06 pm »
I dunno what the original intentions were. But what it is now should be relatively clear: https://platformio.org/

 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #84 on: September 22, 2022, 08:58:42 pm »
I dunno what the original intentions were. But what it is now should be relatively clear: https://platformio.org/
To provide Integrated Debugger, Unit Testing, Static Code Analysis and Remote Development, with Single Source Code on Multiple Platforms? (Just extracted the big letters.)

Aren't these commendable goals?

JW
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #85 on: September 25, 2022, 09:02:35 am »
I have started such a tutorial at https://github.com/cpq/bare-metal-programming-guide

Those who want to contribute or fix mistakes - your PRs are welcome.
Mmm, progress. Nice.

[EDIT] I'd strongly recommend introducing the CMSIS-mandated device headers early on, and then stick to their usage, rather than (re)defining your symbols. I know it means reworking substantial portion of the existing tutorial, but I believe it's worth doing it, from methodological point of view.

One long-time rant of mine is, that those headers don't contain values for non-single-bit bitfields. I see you use enums (enum { GPIO_MODE_INPUT, GPIO_MODE_OUTPUT, GPIO_MODE_AF, GPIO_MODE_ANALOG };) rather than defines, that's a nice idea although I'm not entirely sure what are all the positive and negative ramifications of this. I also tend to visually separate the "register/field" portion of these symbols from the "value" portion by double-underscore (as in GPIO_MODE__INPUT), but that's my personal preference.

JW

PS. Sorry for hijacking the thread again, but I think this *is* somewhat germane to the topic. IDEs suck, but there's no alternative as in decently documented alternatives.
« Last Edit: September 25, 2022, 09:10:53 am by wek »
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2282
  • Country: gb
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #86 on: September 25, 2022, 09:34:23 am »
I have started such a tutorial at https://github.com/cpq/bare-metal-programming-guide

I read through it today, I like the content, style and the pace.

Background on accessing the device registers is good but most newcomers will just want to get going using the manufacturer supplied header, so perhaps some hints where to get those might be useful. IIUC some folks create their own header files from SVD and being able to easily create a header in a style of your choice is appealing.

Looking forward to the reading the Ozone section - I've been considering upgrading my j-link base to get access to Ozone.
 
The following users thanked this post: tellurium

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #87 on: September 25, 2022, 10:10:45 am »
[...]the manufacturer supplied header, so perhaps some hints where to get those might be useful.
To help tellurium: For STM32, https://github.com/STMicroelectronics/cmsis_device_f4 (substitute last two characters for given STM32 family), under Include/. It also contains an example startup code under Source/Templates/.

If you already have Cube (which means the "library", automatically downloaded by CubeIDE or any other IDE) for your STM32 family - or you download Cube from https://github.com/STMicroelectronics/STM32CubeF4 (again substitute last two characters for family) - then the same is under [Cube]/Drivers/CMSIS/Device/ST/[STM32 family]/.

Quote from: voltsandjolts
IIUC some folks create their own header files from SVD and being able to easily create a header in a style of your choice is appealing.
I wouldn't recommend nor even mention this in a tutorial.

One reason for using symbols from the manufacturer-supplied CMSIS-mandated header is that it provides a common denominator, making community support and collaboration easier (or even possible at all).

2 eurocents.

JW
 
The following users thanked this post: tooki, tellurium

Offline tellurium

  • Regular Contributor
  • *
  • Posts: 226
  • Country: ua
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #88 on: September 25, 2022, 10:48:18 am »
Gents, thanks for the suggestions.

Yes, I am quite aware of the STM32 CMSIS include files - the appropriate section in a tutorial is coming soon.

W.r.t. Ozone - I found it the best debugger for the bare-metal firmwares. Ozone is "stand-alone" - once you have a firmware .elf file, built with debug symbols using any framework you like, you just point Ozone to it and it picks up the source, allows to reflash automatically on .elf refresh, etc. No need for an IDE or anything. It provides a handy peripherals view, akin to what Keil provides, which may be helpful to analyze the state of a given peripheral.

I am biased towards printf style of debugging, but when a debugger is required, I prefer Ozone.
Open source embedded network library https://mongoose.ws
TCP/IP stack + TLS1.3 + HTTP/WebSocket/MQTT in a single file
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4003
  • Country: gb
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #89 on: September 25, 2022, 11:15:11 am »
Question:  I'm about to look into ARM development.  I'd like to get fairly low level (after maybe a few Hello Worlds in PlatformIO).

What would you suggest?

On build systems/environments/cicds...

All build platforms suck.

I was exposed to Makefiles after a period without seeing one.  It wasn't a pleasant revival.  I mean, when you are spending your days working with Makefiles you sort of get used to it, but on the surface is a syntax from when bytes were expensive and variables had single or double mnemonics!  Operators and expressions are contracted into symbols with implicit and explicity intermixed in a big fragile tree of of usually script generated non-sense, thousands of C files compiled by "configure" which are ALL recusively generated from automake/conf m4, awk et. al 1960s script languages which ALL suffer from compaction to save memory/disk because it cost $100,000 a megabyte back them!

It doesn't matter what one you choose it will always have unpleasant side effects.

If you are learning, sure, go for a glitzy "black magic" IDE like Arduinno/PlatformIO.  However, do also pause a take a trip down manually building it with an open build platform, like gcc.  But start with a shell script!  I swear when you are learning, by the time that shell script becomes untainable, your first dozen projects will be collecting dust anyway.

In day job I use Java + Eclipse + Maven and I get paid to fiddle with by build tools.  In fact I'd say 90% of my job is either waiting on build tools or trying to figure out why they aren't working.  Especially as those build tools the full CI/CD is shared and locked down with dozens of layers of security.  Maven and Java in enterprise produce deployables sometimes in the multiple gigabytes, mostly code depenencies!  My own project (last touched) had 450 dependencies and produces a 300Mb tar.gz.  The actual application is a single class of about 200 lines and does very simply things.  Recently they demanded we remove ALL vulnerable jars from all projects.  Fine.  But wait.  They scanned the build environment manifest, NOT the deployable manifest.  So if you had a dep with a vulnerable dep included, you override it and upgrade it.  Test it works.  Oh, but no... too late.. you accessed it.  Your build is marked "Out of compliance" and your name appears beside it on a spreadsheet sent out to name and shame!  So even if a build tool like a compiler pulls in an old version of, say, beanutils.  It's over, build fails.  Took me a WEEK! to fix that across 4 projects.  Tedious, unnecessary, dogmatic, bureaucratic BS!

At home I've just come out of a session of "bare metal x86 programming".  Where yes, I spent time with gcc, ld, make, including managing my memory segments and executable format.  I still managed to get a "Hello World", full 64bit long mode, "OS", not much more than a bootloader, but a bit more.... using a shell script.  It had like 10 lines in it.  clean it up, compile/assemble/link make boot.bin run the qemu.


"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #90 on: September 25, 2022, 04:42:20 pm »
All build platforms suck.

Then there's no hope, thus no point in seeking the "best one".
Quote from: paulca
But start with a shell script! 

That's maybe not a bad idea, and I personally lean towards that too... but then again, it depends on the working environment. Surely a "shell script" in Win whichever version is somewhat different from "shell script" in *nix, and yet even more different on whatever the Apple stuff is called this week. Even *running* "shell scripts" is not without challenges. So, for those who write tutorials it's a nightmare; OTOH those who manage to write "shell scripts" don't really need tutorials...

JW
« Last Edit: September 25, 2022, 05:30:36 pm by wek »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4196
  • Country: us
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #91 on: September 26, 2022, 12:04:54 am »
Quote
All build platforms suck.
Then there's no hope, thus no point in seeking the "best one".
Well, yeah.  The interesting question is whether it is better to spend your time getting better at understanding a particular platform (despite its suckiness), or spend similar amounts of time searching for a better (but sucky in different ways) platform.

It's quite the toss-up.

This is the crux of "engineering" - trying to produce "good" results even though all the stuff you have to work with sucks.
 
The following users thanked this post: elecdonia

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8113
  • Country: fi
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #92 on: September 26, 2022, 02:12:47 pm »
You don't need to overthink "build systems" in embedded MCU projects.

The core reason for the existence of build systems is to probe the available libraries, compiler etc. tool versions to build working binaries for your operating system(s), and add some compile time modularity for complex and large desktop applications etc.

MCU development is nearly free of these needs (except maybe some compile time modularity). I have never seen any real use for cmake, for example. Standard makefile is enough and if it seems complicated, reduce until it fits to 1-2 screens.

Going for cmake "so that I don't have to deal with makefiles" is a step in the wrong direction.
 
The following users thanked this post: tellurium

Offline tellurium

  • Regular Contributor
  • *
  • Posts: 226
  • Country: ua
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #93 on: September 26, 2022, 03:23:46 pm »
For those who are interested - I have finished the tutorial. Added a section on UART, IO retargeting (printf redirect), debugging with Segger Ozone, and using a vendor-specific CMSIS headers.

If you find a mistake or wish to extend it, PRs are welcome.
https://github.com/cpq/bare-metal-programming-guide

Thanks to those who came up with suggestions!
« Last Edit: September 26, 2022, 03:27:06 pm by tellurium »
Open source embedded network library https://mongoose.ws
TCP/IP stack + TLS1.3 + HTTP/WebSocket/MQTT in a single file
 
The following users thanked this post: nctnico, thm_w, JPortici, uliano

Offline wek

  • Frequent Contributor
  • **
  • Posts: 486
  • Country: sk
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #94 on: September 26, 2022, 04:07:50 pm »
Wow.

JW
 
The following users thanked this post: uliano

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4003
  • Country: gb
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #95 on: September 26, 2022, 04:10:33 pm »
So, for those who write tutorials it's a nightmare;

Yea.  Tutorials have to pick their fights and stick to them.

I have been frustrated trying to find advanced OS functionality tutorials.  I keep finding things like Paging and memory management with x86_64... only to find it's 99% an Intel ASM tutorial and the only actual bit about paging and memory management is a single slide discussion flat VM space.

Similarly I have found it refreshing to find tutorial on at least some basics of OS development that completely side stepped the whole build environment, using shell scripts.  He also completly side stepped most C++ coding standards and included CPP files etc.  A lot of people gave his shit in teh comments. I just thought he had the right attitude.  Can you tell I'm not a dogmatic engineer.   I mean if you can build it out cardboard and it works once and only needs to work once... why build it out of wood?
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 3671
  • Country: gb
  • Doing electronics since the 1960s...
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #96 on: September 26, 2022, 08:32:17 pm »
Gosh, tellurium's writeup is amazingly detailed.

It has some really clever bits in it e.g.

Code: [Select]
 
  for (long *src = &_sbss; src < &_ebss; src++) *src = 0;
  for (long *src = &_sdata, *dst = &_sidata; src < &_edata;) *src++ = *dst++;

  main();             // Call main()
  for (;;) (void) 0;  // Infinite loop in the case if main() returns

First two lines replace a whole load of asm in the traditional startup... .s file. The last one is an imaginative bit of C which completely baffles me but then I just use C in a basic way.

I am a bit surprised that CPU works with just this

Code: [Select]
uart->BRR = FREQ / baud;
because the 32F417 uses two registers and you decompose the baud rate into these two, so weird values like 120000 baud are possible with quite a high accuracy, when the clock (16MHz in this case) is not a power of two. I have never seen a UART which could get a usefully accurate 115200 with a 16MHz xtal. There is a thread here on how the dual-divider thing works, but nobody was quite sure. I reckon it was using some form of fractional-N synthesis. But I am probably missing something obvious.

I am very happy I don't have to write that base code again :)
« Last Edit: September 26, 2022, 08:45:23 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 
The following users thanked this post: tellurium

Offline tellurium

  • Regular Contributor
  • *
  • Posts: 226
  • Country: ua
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #97 on: September 26, 2022, 09:22:34 pm »
Code: [Select]
uart->BRR = FREQ / baud;

That code should be like this:

Code: [Select]
uart->BRR = FREQ / PRE / baud;
Where PRE is the APB prescaler. By default, when a system clock is not modified, it is 1. I didn't add that to make things simpler.
Open source embedded network library https://mongoose.ws
TCP/IP stack + TLS1.3 + HTTP/WebSocket/MQTT in a single file
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14313
  • Country: fr
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #98 on: September 26, 2022, 09:24:48 pm »
Nice work I have to say.
 
The following users thanked this post: tellurium

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4196
  • Country: us
Re: Rant... Why I dumped Platform IO IDE after a week
« Reply #99 on: September 27, 2022, 01:32:44 am »
Quote
I am a bit surprised that CPU works with just this
Code: [Select]
uart->BRR = FREQ / baud;
I've complained about the horrible process that ST libraries go to set the baud rate for a long time.
2014: https://www.eevblog.com/forum/microcontrollers/one-dollar-one-minute-arm-development/msg516710/#msg516710
More recently: https://www.eevblog.com/forum/microcontrollers/is-st-cube-ide-a-piece-of-buggy-crap/msg3900779/#msg3900779

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf