helpme
Posts: 124
Joined: Thu May 16, 2013 2:20 am

Arduino-like libraries for bare metal programming

Wed Aug 07, 2013 1:06 pm

Are there Arduino-like libraries for bare metal programming of Raspberry Pi? Arduino libraries are so easy to use. It will be wonderful if such a thing exists. Does it exist?

dwelch67
Posts: 966
Joined: Sat May 26, 2012 5:32 pm

Re: Arduino-like libraries for bare metal programming

Fri Aug 09, 2013 2:31 pm

I dont know of one but you are not the first to ask about it. It sounds like a project you should take up, roll up your sleeves, and dig in up to your elbows. Very educational in a number of ways.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Arduino-like libraries for bare metal programming

Sat Aug 10, 2013 11:36 am

DexBasic is very similar to the Arduino language with embedded libs to make bare metal RPI programming easier.
But i have stop working on it.
http://www.dex-os.com/DexBasic/DexBasic.htm

Your free to take it further, if you want.
Batteries not included, Some assembly required.

Sagexs
Posts: 14
Joined: Tue Jul 02, 2013 12:29 pm

Re: Arduino-like libraries for bare metal programming

Thu Aug 29, 2013 12:05 pm

I am really interested in something like this too. I think I will write a lib for gpio, uart, i²c and a 8 and 16 bit parallel port, interrupts (if i can't find anything similar). Most of the code is already written at https://github.com/dwelch67/raspberrypi ) but not combined in a library. Access to Ethernet and Usb would be great but realy hard ...

dwelch67
Posts: 966
Joined: Sat May 26, 2012 5:32 pm

Re: Arduino-like libraries for bare metal programming

Thu Aug 29, 2013 2:20 pm

USB makes it painful, Chadders has a library for usb, called CHUD maybe? I dont remember. I have been meaning to play with it but havent. I need to learn usb someday, or maybe if I wait long enough it will get replaced with something else and I will learn that.

Once over the usb hurdle then it is the ethernet chip and that may or may not be difficult, making a UDP/IP stack is not hard, you can do a bit of cheating (dont do arps every 60 seconds to find the address for an ip address, just examine the packets coming in or operate strictly as a master slave and respond directly to incoming packets). Or maybe just use lwip.

Someone has a fancy bootloader now that may have usb plus sd card and maybe ethernet...

David (a.k.a. dwelch67)

majenko
Posts: 18
Joined: Fri Jun 01, 2012 9:53 am

Re: Arduino-like libraries for bare metal programming

Sun Dec 01, 2013 9:56 pm

I am working on a Raspberry Pi core for my UECIDE project.

UECIDE is a port of the Arduino IDE and is aimed at running with many many different microcontrollers. PIC32, AVR, Arm, etc.

My latest endeavor is to make a core for compiling programs on the Pi (running UECIDE directly on the Pi) using the same API as the Arduino does. The aim is that you can then use a lot of the existing Arduino libraries for interfacing with external hardware, and you don't need to learn a new environment when switching from Arduino to Pi.

It's incomplete at the moment, but I'm looking for testers and feedback to help shape the project into what it needs to be.

http://uecide.org

At the moment the core supports:

GPIO input and output
Analog input through an ADC128S102 SPI 8-channel ADC (all I had to hand when I was building my breakout - I want to make it work with more).
Software PWM on all pins (350Hz, running in separate thread - software because the PWM in the Broadcom chip is a nightmare, and only 1 pin besides!).
SPI with manual chip-select (the same way you do with the Arduino - compatibility is everything here...)
"uploading" the program to the microcontroller launches the program in an X Terminal.
Console class that works like the Serial class of Arduino (for stdin/out).
Serial class through /dev/ttyAMA0, and can be used on other serial devices too (USB dongles, Bluetooth rfcomm, etc).

There's no I2C yet, though I will be implementing that soon (I just need to knock up some hardware to test it with).

So yeah, try it out and give me some feedback,
They say computers only do what you tell them to. They're wrong. Mine still hasn't gone to hell.

mram
Posts: 7
Joined: Sun Nov 24, 2013 6:46 am

Re: Arduino-like libraries for bare metal programming

Tue Jan 14, 2014 3:39 am

It seems to me the "bare metal" side of Raspberry PI is underestimate and few people who needs/wants to program can't share easily (without loosing themselves in the "internet ocean") their work, like Arduino can do. Good works around but totally disconnected and without a clear reference. Me too, I made a lot of bare metal code (good or not), probably duplicating works already done, and there isn't a repository or even an official sticky post where collect at least the links of sources available... :(

Hope it will change, working on that :)

Return to “Bare metal, Assembly language”