C++ on the AVR port

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderators: utzig, tfAteba

mikenick42
Posts: 28
Joined: Tue Mar 10, 2015 4:49 pm
Been thanked: 1 time

C++ on the AVR port

Postby mikenick42 » Thu Feb 25, 2021 12:29 am

Has anyone had any luck with C++ on the AVR port of ChibiOS? I know the STM port can do it but when I try renaming main.c and moving it in the Makefile I get:

Code: Select all

/usr/lib/avr/include/avr/io.h:623:6: warning: #warning "device type not defined" [-Wcpp]
 #    warning "device type not defined"


It looks like __AVR_ATmega328P__ isn't being defined for some reason.

Is it even worth using C++? I'm mainly interested in it because it makes encapsulation more convenient. What I want should be possible if I'm careful about how and where I declare things in C, but is a little cleaner in C++.

User avatar
tfAteba
Posts: 531
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 83 times
Been thanked: 47 times

Re: C++ on the AVR port

Postby tfAteba » Mon Jun 14, 2021 1:33 pm

Hello,

No I have never try to compile AVR code with C++ compiler.
regards,

Theo.

davidli
Posts: 2
Joined: Fri Jun 11, 2021 7:15 am

Re: C++ on the AVR port

Postby davidli » Thu Jun 17, 2021 7:40 am

Maybe it only works under windows?

User avatar
tfAteba
Posts: 531
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 83 times
Been thanked: 47 times

Re: C++ on the AVR port

Postby tfAteba » Fri Jun 18, 2021 9:53 pm

Hello Davidli,

No it is not related to OS that you use.

Can yous share me the modification that you made in ChibiOS so that I can try to help.
regards,

Theo.


Return to “AVR Support”

Who is online

Users browsing this forum: No registered users and 1 guest