Progress on AVR

395 views
Skip to first unread message

J Adam Crain

unread,
Apr 5, 2014, 3:03:58 PM4/5/14
to automat...@googlegroups.com
All,

I've made some fantastic progress in the last week on a feasibility study on getting opendnp3 to run on a "bare metal" system.

If anyone's curious, check out the "runnable" branch.

1) No STL
2) No dynamic allocation
3) No C++ standard library (chrono, mutex, limits, etc).

I've got the code cross compiling using ATMEL's AVR Studio for the Arduino Mega2560.  A basic outstation is using 70% of the Flash program storage. I didn't expect this to work at all since the basic Arduinos are 8-bit microcontrollers.

The outstation overflows the stack though, which isn't terribly surprising since the Mega only has 8KB SRAM.  I'm going to turn some of the buffer sizes down for a very basic outstation and see if I can get it to fit. I'm also going to order an Arduino Due (32-bit ARM Cortex with 96KB SRAM. It will definitely fit on there.

The first pass will be to define a simple PAL that superloops a UART and timers. The next step if this works will be to define an interrupt driven PAL.

I'm pretty pumped that this compiles and fits in flash. I expected there to be more "gotchas". Check out the attached presentation that extolls the virtues of using C++11 for embedded systems.

-Adam
EmbeddedC++11 - RainerGrimm.pdf

J Adam Crain

unread,
Apr 8, 2014, 9:34:28 AM4/8/14
to automat...@googlegroups.com
It's working!

I've committed an AVR solution for the atmega2560 (Arduino Mega):


I'm using the AVRISP-mkII to program the Ardunio + AVR Studio.

Last step is to implement the ITimer interface to the get the app layer working right. I'm already talking to it over the serial port using the fuzzer though.

-Adam

Hayram Nicacio

unread,
Dec 3, 2015, 1:42:57 PM12/3/15
to automatak-dnp3

Adam,

It seems a great work you've done.

I am trying to run DNP3 on a bare metal (AVR/ARM) and found these links you published in 2014:
https://github.com/automatak/dnp3/tree/2.0.x/embedded/atmelavr
https://github.com/automatak/dnp3/tree/runnable/amtel

They do not seem available anymore. Where can I get those resources?

Best regards,

Hayram.

Adam Crain

unread,
Dec 3, 2015, 1:50:52 PM12/3/15
to automatak-dnp3
Hi Hayram,

They still exist in the 2.0.1 release tag and were confirmed to be compiling then:

https://github.com/automatak/dnp3/tree/2.0.1/embedded

I didn't have the time with all the rapid changes in 2.1.0 to drag them along and keep them working.

In the future, I hope to put something like this in a separate repository and pull in a tagged version of the main library using git submodules.

Somebody just contracted me to get this running on the esp8266 with the Arduino toolchain. I'll post an update to the list when that happens, but it will definitely be in another repository.

-Adam

Hayram Nicacio

unread,
Dec 3, 2015, 1:57:28 PM12/3/15
to Adam Crain, automatak-dnp3
Thanks a lot.

I will see if I can contribute on that.

Best regards,

Hayram.

J Adam Crain

unread,
Dec 9, 2015, 12:29:57 PM12/9/15
to automatak-dnp3, jadam...@automatak.com
Excellent. Please do report your findings.

Ideally, I would like to see a cmake-based project that builds something embedded using the installed cross-compilers.

It looks like microchip (manufacturers of PIC MCUs) have also recently upgraded their C++ compiler to GCC 4.8.3, meaning that the c++11 stuff in opendnp3 will now compile for those microcontrollers.

-Adam

Gato

unread,
Apr 25, 2017, 11:53:36 AM4/25/17
to automatak-dnp3
Hi Adam!

Do you got any progress on the ESP8266 and DNP3? Well, I'm using an ESP-01 and the Arduino toolchain but it seems that has no good support for C++11 (to my understanding).

What do you think? This is possible or better I search for another target platform?

Greetings!

J Adam Crain

unread,
Apr 25, 2017, 2:17:04 PM4/25/17
to automatak-dnp3
I think it will be difficult. The ESP8266 was very poorly documented.

This linux platform has similar form factor, wiki, cost etc:

https://onion.io/store/omega2/

Gato

unread,
Apr 26, 2017, 1:33:17 PM4/26/17
to automatak-dnp3
Thank you for your answer Adam!

The Onion  board looks much better than ESP8266 but I'm thinking of a platform without Linux embedded. For the later, I have a RPi3 running the example code from the 2.2.0 tag.  Maybe I should start with a review of the code for the 2.0.1  tag and the AVR demo code. If you have some advice about AVR, it will be welcome.

Greetings!

Adam Crain

unread,
Apr 26, 2017, 3:16:51 PM4/26/17
to automatak-dnp3
I did ended up getting the outstation to run on AVR on the 2.0.1 tag, but a lot of the C++ standard library has since crept back in.

The challenges you'll have will be smart points, std::function, etc.

Attempting to keep the library bare-metal portable was a goal that I considered, but have since abandoned. Fewer and fewer people are putting DNP3 on bare metal devices these days.

-Adam

DIERSON ANTONIO DE LIMA SILVA

unread,
Jan 11, 2022, 11:27:49 AM1/11/22
to opendnp3
Hi guys

I`m trying to get lib 2.0.1 to work on ESP32. I Can connect for a moment and then theconnection not work. 

As long as the master doesn´t try to connect to the outstation works.

Adam Crain

unread,
Jan 11, 2022, 11:28:41 AM1/11/22
to opendnp3
We ended up  not supporting the library on microcontrollers.
Reply all
Reply to author
Forward
0 new messages