I want to upload my program onto an ATmega32 with avrdude and usbtiny. I do not want to use the arduino framework. In my understaning, you should only need to remove the ‘framework=arduino’ line to get it to work, but when i do it the build finds 0 compatible libraries, and then getting this fault line
src/main.cpp:1:10: fatal error: Arduino.h: No such file or directory
When I have the ‘framework=arduino’ line added, the build and upload finishes succesfully, but the code does not run on the microcontroller.
Here is my code in main.c:
#include <avr/io.h>
#include <utils/delay.h>
#define PA0 0
int main() {
DDRA |= 1 << PA0;
PORTA |= 1 << PA0;
while (1) {
_delay_ms(500);
PORTA ^= 1 << PA0;
};
}
– added info: the PORTA, and DDRA does not light blue, just stays white but with no red line or fault message. Im sure this is more of a vscode fault?
This is my platformio.ini file
[env:ATmega32]
platform = atmelavr
board = ATmega32
lib_compat_mode=soft
upload_protocol = custom
board_build.f_cpu = 1000000UL
lib_ignore = arduino.h
lib_ldf_mode=off
debug_tool = simavr
; each flag in a new line
upload_flags =
-pm32
-cusbtiny
-B4
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
Can it be that avrdude is not correctly inputting the .hex file into the ATmega32?