I’m a newbie here, downloaded (Mac OS) PlatformIO 2 days ago.
I want to write purely in assembly language (AVR) to some Attiny85 or Atmega328P µC. So far I made it immediately and smoothly working with an Raspberry PI using the avrdude via the Terminal. Now I wanted to use my Mac and a simple programmer as well as PlatformIO to do basically the same (maybe with less wires and raw electronic stuff around): just writing pure assembly code for some of these Attinys and Atmegas.
My question is, do I need to go via all this “create projects” options and do i need this workspace with “.pioenvs” and “.vscode” and all that? If yes, how do I do it?
For now I went via creating a new project and chose a generic attiny85 with the Arduino platform. But i dont want any Arduino integration on the chip. I wrote a simple assembly program and wanted to include in the header a special tn85def.inc file (long story short, some of the tn85def.inc files around have an error in their timer/interrupt definitions).
Where do I have to put this file so that the “Build” option does not reply with an error of not finding the tn85def.inc file? So far located it in “src”, but also in “include”.
Thanks for any kind of help, which is very much appreciated.
Be careful with the assembler include files though, the tn85def.incI found is apparently written in the assembler syntax for the Atmel Studio assembler and will cause syntax errors when compiled with avr-gcc/avr-as.
Thank you for your quick reply and the hint for leaving out the framework Arduino line in the ini. I succeeded in setting up avra and avrdude together with the usbasp programmer and simply put some hex files in the flash of an attiny85. I would love PlatformIO to simply take care of all the commands so that i simply press a button and the program is inside the flash. …think I need to experiment further a bit.
So that worked now just perfectly! Thanks a lot!! I can now use the PlatformIO upload button and its on the attiny85.
Now, in Finder it says that my folder for that program is 71MB, basically its the .vscode Folder inside my “project folder”. Can I erase that folder or how can I make assembly program projects in PlatformIO that do not use this .vscode folders?
Cleaning compilation files is done by executing the pio run -t clean target.
You can also just create projects from the CLI without having to generate project files for an IDE. For example, run pio run -b attiny85 in an empty folder. Then adapt the platformio.ini to your needs again and upload using the CLI with pio run -t upload etc.
Ah, because when you install the PlatformIO IDE (VScode), it has its own seperate PIO core and is not included in the system path. You can install a system-wide PlatformIO using pip install -U platformio and then, if needed, tell the VSCode PIO plugin to use the global core instead of the builtin core. See Redirecting.... Also refer to Redirecting....
That was helpful, thank you again! I read through the documentation, I am able to use pio commands from the bash and I’m now able to create workspace folders and write assembly code in it. What i didn’t make running was to integrate e.g. a file like tn85def.inc … lets say i create this file in the include folder of a workspace. The file was only recognized when I saved it (copy and paste in Finder) into my project folder, but gave me a lot of errors (e.g. tn85def.inc:664: Error: expected comma after “PCI0addr”).
Any idea how i can integrate certain *.inc files? (in your first comment you warned me of using files such as tn85def.inc because they might cause syntax issues. Assume its happening what you meant, isn’t it?)
… but isn’t somewhere with the PlatformIO IDE Package coming a folder with all Atmel Chip definitions, which I could just integrate in a certain way?
If not, I should integrate register definitions in the header of my codes for keeping it minimal and simple (can be a good way of learning and memorizing by heart all hex addresses of any register, port and so on of these Atmel chips)
Unfortunately I dont find that folder in my PlatformIO installation. How can I install and integrate it in my system so that i can just add the header #include <avr/io.h>?
Thanks for your patience and help!
In your PIO home folder (/home/<user>/.platformio or C:\Users\<user>\.platformio) you must have packages/toolchain-atmelavr folder where the compiler tools are, otherwise you wouldn’t have been able to compile the previous project. Do you find your PIO home folder at the expected place? (maybe cd / && find . -name ".platformio"?)
Yes. Found it. But when I use the #include … header, its compiling without errors, but the LEDs (even after playing a bit around with the LEDS or setting to HIGH other bits at the port, the LED doesnt light up.
Yes, the #define commands work.
Even the include <var/io.h> command doesnt produce an error when I “Upload”, but when I “Build” it says that "no such file or directory. When i put the entire folder root, nothing. “Upload” doesnt produce an error, but of course the LED do not light up (only with the #define commands.