Author Topic: Transitioning from Arduino IDE 2 to Microchip Studio  (Read 6160 times)

0 Members and 2 Guests are viewing this topic.

Offline mvno_subscriberTopic starter

  • Regular Contributor
  • *
  • Posts: 82
  • Country: no
Transitioning from Arduino IDE 2 to Microchip Studio
« on: April 15, 2023, 08:27:55 pm »
Hi,

I'm trying to move away from Arduino and thus adapt my code and make it work in Microchip Studio.

I'm having a few issues. First, Microchip Studio has a "Create project from Arduino Sketch" option when creating a new project. I tried this, it complained about a missing "Arduino.exe" in the Arduino application folder. Renamed "Arduino IDE.exe" to "Arduino.exe", it halted along but only imported my main sketch file. I had to manually copy over header files.

Also, it seems to not have properly imported the arduino libraries. For example, "Arduino.h" is missing.

So, I thought I should perhaps start a new "native" project, import my files and adapt accordingly. However, I have no idea whether I should use AVR XC8 or GCC, or what this even means in practice.

Is all this hassle because I have too new a version of Arduino IDE? I understand version 2 has made some radical changes to file locations and so forth.



What is the best way for me to move forward with this? My codebase is currently not very large, and apart from analogRead(), delay() and some register constants (like PORTD, DDRD etc) I'm not heavily dependent on the Arduino libraries as far as I can tell.

I will be getting an Xplained Mini board in the near future, but being able to use the Arduino Uno in the meantime would be very practical.
 

Offline barshatriplee

  • Regular Contributor
  • *
  • !
  • Posts: 130
  • Country: bd
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #1 on: April 16, 2023, 02:25:06 am »
You can create a new "native" Microchip Studio project and manually import your files. This will give you more control over the project and allow you to remove any unnecessary Arduino libraries and code that you're not using.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #2 on: April 16, 2023, 03:57:59 am »
It might be expecting an older version of the Arduino IDE. Isn't 2.0 quite a bit different? I've run into several challenges with Arduino caused by having the wrong version of the IDE.
 

Offline Lindley

  • Regular Contributor
  • *
  • Posts: 198
  • Country: gb
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #3 on: April 16, 2023, 08:45:51 am »
You want to add in vMicro to Studio, which allows you use run your existing and new Arduino ide projects, as Studio with Vmicro  will automatically save your files in the Arduino folder, uless you specify differently.
You can still  load  Studio sketches back into the Arduino ide.
This link shows how to do it with Microchip studio, which is , as far as we know, identical to the older Atmel studio we use with vMicro.
https://www.visualmicro.com/page/Arduino-for-Atmel-Studio-7.aspx

Suggest you keep your Arduino IDE as it handy for loading in new libraries and quiclky viewing other sketches etc etc
 
The following users thanked this post: mvno_subscriber

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4281
  • Country: us
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #4 on: April 16, 2023, 07:57:49 pm »
Quote
Isn't 2.0 quite a bit different?
AFAIK, Microchip has never done (nor claimed) anything specific to allow Studio to import sketches from the IDE 2.0.That said, there isn't that much that has changed in 2.0 WRT locations of files and cores and such.  (Hmm.  I think in 1.x, there was still a copy of the AVR core and tools in the Programs Files directory of the IDE, but in 2.x, everything has moved to the AppData location.)
It's not entirely clear that Studio ever got past the 1.5ish "revised 3rd party specs" that moved 3rd party boards to the AppData directories, or that it ever worked "well", even before that.

It's not clear whether Studio is under "active" development, or whether Microchip is going to abandon it and migrate users to MPLABX.  :-(
Quote
it seems to not have properly imported the arduino libraries. For example, "Arduino.h" is missing.
Arduino.h is considered part of the Arduino Core, rather than a "library."  (although that "core" code and it's include files might be regarded as a library by Studio...)

Quote
I have no idea whether I should use AVR XC8 or GCC, or what this even means in practice.
You should use gcc (the Arduino IDE uses gcc.)
XC8 is essentially GCC with added restrictions, and perhaps different libraries.  Last time I looked, XC8 had essentially broken floating point support for AVR by replacing the avr-libc functions with code that was about 10x bigger. :-(
Quote
What is the best way for me to move forward with this? My codebase is currently not very large, and apart from analogRead(), delay() and some register constants (like PORTD, DDRD etc)
What is your actual goal?  If you are just after a "better" IDE for Arduino sketches, that's going to be different than if you want to transition "past" the Arduino framework entirely.
delay() is easily replaced by _delay_ms() from avr-libc.  (but replacing millis() is harder.)
PORTD, DDRD, etc, is NOT from Arduino; those are the Atmel-provided definitions.

In either case, you'll need to pay more attention to a bunch of the stuff that you've admitted to not knowing, with more diffuse documentation, less community support, and less actual "steal-able" code for supporting random external peripherals.

 
The following users thanked this post: mvno_subscriber

Offline Ground_Loop

  • Frequent Contributor
  • **
  • Posts: 663
  • Country: us
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #5 on: April 17, 2023, 03:00:02 am »
VS code with Platform IO seems to be a popular alternative. And it will import Arduino sketches.
There's no point getting old if you don't have stories.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4281
  • Country: us
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #6 on: April 17, 2023, 06:03:53 am »
Quote
VS code with Platform IO ... will import Arduino sketches.

From IDE v2.x?
 

Offline uliano

  • Regular Contributor
  • *
  • Posts: 178
  • Country: it
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #7 on: April 17, 2023, 08:04:05 am »
sorry for jacking in...

It's not entirely clear that Studio ever got past the 1.5ish "revised 3rd party specs" that moved 3rd party boards to the AppData directories, or that it ever worked "well", even before that.

It's not clear whether Studio is under "active" development, or whether Microchip is going to abandon it and migrate users to MPLABX.  :-(
Microchip studio is EOL and no more in development.
Quote

What is your actual goal? 

Id' like to be able to debug with Atmel-ICE

I 'm able to import .ino's with MegacoreX or DXCore (which are the most interesting) with MPLABX but then I can't debug. Is it ever possible? (given that someone can understand that mess)

With microchip studio, on the contrary I'm not able to create new project using any of the custmo cores/boards I installed into Arduino.

From what you say above I'm hoping that somewhen in th past files for external core suppot got moved by arduino adn that could be the reason Microchiop studio isn't able to find them anymore.

So question is

where were those files stored before being moved under appdata?
 

Offline mvno_subscriberTopic starter

  • Regular Contributor
  • *
  • Posts: 82
  • Country: no
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #8 on: April 17, 2023, 08:04:54 am »
Thanks a lot for the replies, the main reasons I want to move away from Arduino are not only proper development tools and debugging, but I also find it difficult to work with many of the restrictions. For example, I can't (or it's difficult to) program the fuses, I have limited interrupts, and the way Arduino uses its own pin numbering scheme is very frustrating. I'll be using the MCU standalone.

I have programmed PIC controllers in assembly before. C/C++ is new to me, but I've worked as a developer in java/.net for many years so I guess this is the "middle ground". As such, Visual Studio isn't unknown, but still I do realize there is a steep learning curve. I won't be doing any protocol interfacing (except IR remote control), so there's a limited need for specialized libraries.
 

Offline mvno_subscriberTopic starter

  • Regular Contributor
  • *
  • Posts: 82
  • Country: no
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #9 on: April 17, 2023, 08:05:58 am »

Microchip studio is EOL and no more in development.

Wait, what? What do people use, then?  :o
 

Offline uliano

  • Regular Contributor
  • *
  • Posts: 178
  • Country: it
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #10 on: April 17, 2023, 08:09:55 am »
MPLABX, if they can...
« Last Edit: April 17, 2023, 08:30:13 am by uliano »
 

Offline mvno_subscriberTopic starter

  • Regular Contributor
  • *
  • Posts: 82
  • Country: no
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #11 on: April 17, 2023, 08:16:33 am »
Wow.. and no telling on the product page! Good I hadn't started migrating yet, then. I'll toss this silly putty out of my window and grab a copy of MPLABX, then.
 

Offline uliano

  • Regular Contributor
  • *
  • Posts: 178
  • Country: it
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #12 on: April 17, 2023, 08:27:46 am »
I woudn't be so smug if I were you...
« Last Edit: April 17, 2023, 08:29:50 am by uliano »
 

Offline Lindley

  • Regular Contributor
  • *
  • Posts: 198
  • Country: gb
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #13 on: April 17, 2023, 07:53:57 pm »
If you are not happy staying with Studio, then agree that Platform IO is probably the best for you.

Its a newish program,   2014 ,  also based on Microsoft VS  and the Platform IO Plug In is still being regularly developed and has a good following.

Considerably different to using the Arduino IDE and has loads of features you are looking for.
eg  fuse programming - https://docs.platformio.org/en/stable/platforms/atmelavr.html#fuses-programming

MplabX took several years to iron out many of its bugs, so no idea what their replacement for Studio would be like, if at all ?

 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4281
  • Country: us
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #14 on: April 17, 2023, 07:54:35 pm »
Quote
where were those files stored before being moved under appdata?
\Program Files\Arduino\hardware\<less clear>

Quote
Microchip studio is EOL and no more in development.
Reference?  There was a PCN from 2019 when they discontinued the physical DVD, but I haven't seen anything but speculation since then...
 

Offline uliano

  • Regular Contributor
  • *
  • Posts: 178
  • Country: it
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #15 on: April 18, 2023, 05:10:29 am »
I have read it some time ago (~1 year??) on Avrfreaks, possibly by Microchip emplyee,  (but I forgot the reference): Microchip Studio won't ever be upgraded for Window 11 (even if it works seamlessly) and its support will crease in 2025 together with windows 10. Microchip is trying to converge all platforms to MPLABX (which would make a lot of sense if MPLABX weren't that huge pile of crap  |O )

Maybe if I install an older version of arduino I can shad light over <less clear> do you remember which version?
« Last Edit: April 18, 2023, 05:33:22 am by uliano »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4281
  • Country: us
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #16 on: April 18, 2023, 05:54:25 am »
Quote
do you remember which version?
It may be before there was a "board manager", and I'm just remembering the instructions for how to install new cores without it.  Ie: https://github.com/MCUdude/MiniCore#manual-installation  (I'm not sure that ever worked for boards that required a new compiler?)

 

Offline uliano

  • Regular Contributor
  • *
  • Posts: 178
  • Country: it
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #17 on: April 18, 2023, 06:46:07 am »
Update, sad.

I succeeded in making Microchip studio see the third party cores by installing arduino 1.6.4 (the first one with board manager) but, alas, neither with MegacoreX nor with DxCore Microchip studio was able to produce a viable project (thrown some errors here and there)

I'm afraid I have to quote Gandalf here: Microchip Studio way to Arduino is shut.

 :-//

MPLABX, instead, can produce working projects with those cores. but I declare myself unable to debug using that pile of steaming crap. And that was the only reason to go that way.

« Last Edit: April 18, 2023, 06:50:54 am by uliano »
 

Offline uliano

  • Regular Contributor
  • *
  • Posts: 178
  • Country: it
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #18 on: April 18, 2023, 08:24:52 am »
Update, bis. Sad again.

As I didn't waste enough time with microchip crappy sw I went a little over than blinky and imported the sketch in MPLABX with MegacoreX.

The led blinks but, alas, serial monitor isn't working (and with Arduino ide it was). It's not even a a clock question that pin simply doesn't go low, ever.

So, at least for me, the choice is dichotomic: either Microchip Studio and its usable debugger OR Arduino libraries.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17990
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #19 on: April 23, 2023, 07:47:23 pm »
Here's a tip, just forget about the arduino, you are either using it and it's lets say specific way of doing things or you are letting yourself loose on a microcontroller and now have full control over it and are not tied to the particular one the arduino happens to use.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17990
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #20 on: April 23, 2023, 07:49:19 pm »
Update, bis. Sad again.

As I didn't waste enough time with microchip crappy sw I went a little over than blinky and imported the sketch in MPLABX with MegacoreX.

The led blinks but, alas, serial monitor isn't working (and with Arduino ide it was). It's not even a a clock question that pin simply doesn't go low, ever.

So, at least for me, the choice is dichotomic: either Microchip Studio and its usable debugger OR Arduino libraries.

Do you know how much code is required to set the serial port up? less than 10 lines. Do you know how much code it takes to send a message?

"serial port buffer" = "data you want to send"

Seriously forget the arduino.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12459
  • Country: ch
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #21 on: April 24, 2023, 11:26:30 am »
Quote
VS code with Platform IO ... will import Arduino sketches.

From IDE v2.x?
Sketches themselves aren’t specific to an IDE version.

PlatformIO doesn’t rely on an installed instance of the Arduino IDE for its Arduino libraries (it downloads them itself) so it doesn’t need any installed IDE to import them.

Bearing in mind that it’s also easy to do yourself:
1. Make a new project in PlatformIO using the Arduino framework.
2. Copy your code into the main.cpp file.
3. Install the libraries used into the project
4. In your main.cpp file, create function prototypes for any of your own functions.
That’s it.

In fact, if you use the .ino file extension, you don’t even need to add the function prototypes. But you miss out on some IntelliSense (code autocomplete) features.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4281
  • Country: us
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #22 on: April 25, 2023, 11:59:26 pm »
Quote
PlatformIO doesn’t rely on an installed instance of the Arduino IDE for its Arduino libraries (it downloads them itself)
I didn't' know that.  Neat!  It should help a lot, assuming that it gets the correct libraries for each platform (ie the SPI library is different for SAMD vs AVR.)

 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12459
  • Country: ch
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #23 on: April 26, 2023, 07:36:53 am »
Quote
PlatformIO doesn’t rely on an installed instance of the Arduino IDE for its Arduino libraries (it downloads them itself)
I didn't' know that.  Neat!  It should help a lot, assuming that it gets the correct libraries for each platform (ie the SPI library is different for SAMD vs AVR.)
It knows.

I haven’t looked into how it’s implemented exactly, but basically, in PlatformIO, a project (or more specifically, the build environment for the project) has two core settings: the software framework (Arduino, CMSIS, CubeMX, etc.) and the board (Arduino Uno, ESP32 dev kit, STM32 Nucleo L432, etc). The latter is what defines all the hardware, which frameworks are available, the toolchain used, etc. In either case, it downloads it as needed.

One of the big advantages of PlatformIO over the Arduino IDEs is library management. Whereas Arduino has the “easy” but problematic approach of installing libraries globally, PlatformIO has you install libraries to a project, so that you can use specific library versions for each project, including the not-so-rare occurrence of third party libraries with conflicting names. (*cough* DS3231 *cough*)

So via the board definition it will select and procure the correct SPI library for your board.

You can also assign multiple build environments within a project — for example, Arduino Uno and ESP32 dev kit and Arduino Due and a compatible Nucleo board — and then select which one you want to compile and flash. Each build environment has its own library definitions, so if you had MCU-specific code, you could either use #ifdef blocks to insert build environment specific code (for example, #ifdef ARDUINO_AVR_UNO for the Uno and #ifdef ARDUINO_ESP32_DEV for the ESP32 board), or you could save the hardware-specific code to hardware-specific libraries with the same filenames and then use the build environment settings to include the correct one for each.
 
The following users thanked this post: elecdonia

Offline uliano

  • Regular Contributor
  • *
  • Posts: 178
  • Country: it
Re: Transitioning from Arduino IDE 2 to Microchip Studio
« Reply #24 on: April 27, 2023, 07:11:46 am »
Update, bis. Sad again.

As I didn't waste enough time with microchip crappy sw I went a little over than blinky and imported the sketch in MPLABX with MegacoreX.

The led blinks but, alas, serial monitor isn't working (and with Arduino ide it was). It's not even a a clock question that pin simply doesn't go low, ever.

So, at least for me, the choice is dichotomic: either Microchip Studio and its usable debugger OR Arduino libraries.

Do you know how much code is required to set the serial port up? less than 10 lines. Do you know how much code it takes to send a message?

"serial port buffer" = "data you want to send"

Seriously forget the arduino.

My trajectory started with Atmel Studio, then I adopted VSCode for many other stuff and become addicted to IntelliSense so I switched to Platformio that, for avrxxxDx, allows you to create only "Arduino framework" projects. The fact that the framework is there doesn't force you to use its API, in fact I only use millis() and Serial, the rest of the code accesses peripheral registers directly.

On occasion I feel the lack of the debugger and I would have liked to be able to convert the project for Microchip Studio or MPLABX IDE. Alas, I can't.

Besides, I find your register quite patronizing.
 
The following users thanked this post: tooki


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf