Raspberry Pi 2 B GPIO Native C library - c

I have recently ordered a Raspberry Pi 2 Model B but after doing some research I am unsure whether or not it comes with a native C library for the GPIO. I have seen that there are several 3rd party libraries such as WiringPi, but I would've preferred to use a native one if it exists. This website seems to indicate that it does exist.
Edit: By native, I mean a library that comes out of the box with the Pi, either was officially implemented by the Foundation or Linux on release of the product or at least has very low-level access to the pins, and has been thoroughly tested on this model.

Related

What are the conditions to make the embedded C code written for one processor to work on another processor (when architecture is same)?

I am reading a primer text on embedded C programming (it is: Barr & Massa, 2007). For companion hardware board to run examples, they recommend Arcom VIPER-Lite. But I do already have Beaglebone Black (BBB) board and I don't want to buy a new board.
The two boards have same architecture, namely, ARM but BBB uses TI AM3358BZCZ100 processor, clocked at 1GHz, whereas VIPER-Lite uses Intel's PXA255 processor, clocked at 200MHz. The BBB board has more memory and basically more of everything.
My question is, can I follow and execute embedded C code examples given in this book on my BBB board? Does embedded C code depend on processors or architecture or something else? I understand that very specific examples addressing particular peripherals/drivers may not be portable from one platform to next but is entire embedded code like this? I am hope I am making sense.
Intel X-Scale is not the same as Cortex-A8 - ARM architecture has been through a number of versions since then, and Intel implemented some proprietary features too. Moreover ARM licencees are free to implement proprietary peripheral sets and subsets of the core architecture.
In particular for board bring-up the PLL and SDRAM controller will be entirely different between different vendor's devices and even between different generations of device from the same vendor.
If you are running code on an already implemented OS (BeagleBone is delivered with Linux already installed), then you will not need to worry about board bring up and peripheral support; but you will also miss out in learning a great deal about embedded systems (other than perhaps embedded systems that run pre-installed or vendor supplied Linux distros, which is a small subset or all embedded systems).
Beyond board bring up the boards will have entirely different peripheral sets, different on-board devices, and differing I/O at different addresses and with different register sets - no code that directly accesses the I/O is will work. Code accessing devices through a standard Linus device driver interface may well work because an abstraction to a common interface is provided by the OS and board vendor or third party device drivers.
If you are not running the code on Linux - or are implementing low-level device drivers, then the programming environment in terms of memory map, MMU, PLL, I/O control, peripherals, and even instruction set will be different and any code will require adaptation, and you will need to get familiar with the corresponding data sheets or reference manuals and also the ARM technical reference.
So the answer is that it depends largely on where you are starting from; bare-metal or Linux.
There are resources related to "bare-metal" development on BeagleBone Black in particular TI's own bare-metal StarterWare library.
The concept you learn from most good text books can be applied any microprocessor or micro controller at a very high level. But if you want learn embedded system programming using Beagle Bone Black I suggest the following youtube links from Prof Derek Molloy. Prof Molloy does a fantastic job of teaching embedded System programming using BBB. Here are few links for you to get started.
The Beaglebone - Unboxing, Introduction Tutorial and First Example
Beaglebone: C/C++ Programming Introduction for ARM Embedded Linux Development using Eclipse CDT
Beaglebone: GPIO Programming on ARM Embedded Linux
The one problem you might want to be aware is that the video were based on Angstrom Distribution. The current BBB is shipped with Debian Distribution.
Also if you want to learn bare-metal embedded system program you might want check out
Embedded Systems - Shape The World
You might also want to take look at the following link for more material.
Beginning with programming microcontrollers
The xscale although ARM instruction set derived is not ARM in the sense that you want to use it. For some reason the native mode is big endian and normal ARM native mode is little endian. But more important the core processor is not insignificant, but not the bulk if the porting effort, most of not all of the peripherals are expected to differ between those two chips, most of the code would need a re-write unless it is a purely portable C program that runs on any say linux, then arm, xscale, x86 are completely irrelevant to the discussion. I suspect you are not in that situation. Even compiled as a generic command line linux app would still have problems in this situation with the endianness.
Basically you are saying I have two fords and I want to take the wheels off of one and put them on the other, without understanding that one is a ford festiva and the other is lets say an F350 pickup. Just because they have the same looking tiny ford badge on them, doesnt mean that the entirety of their components are identical.
If you are desperate to re-use these binaries, you are better off finding or making a simulator for the prior platform and then you can run that on anything.

Connect SSD1306 OLED Display to BLE Nano

My experience with micocontrollers and electronics is limited to ATmega Controllers, programmed in C and some tranistors and displays, nothing too special.
However, I want to get my hardware one step smaller, and want to start using the BLE Nano for all Bluetooth related projects.
For a first example project I'd like to create a bluetooth enabled temperature sensor with a small display.
As Display I chose the 0.96" OLED Display from Adafruit, which features a SSD1306 Controller. Adafruit offers a library for it (here: https://github.com/adafruit/Adafruit_SSD1306 ) but it is not clear to me, if I can use this library together with the BLE Nano.
I realized that I was to fixated on using the arduino library for my "normal" project.
There are other libraries out there, for example on github, which are written in plain c and should therefore be easier tot adapt for different platforms.
The Adafruit library is an Arduino library, so you would need to register your BLE Nano module in order to gain access to Red Bear's pre-release Arduino library - See the "Using Arduino" section of the "Getting Started with nRF51822" page

OpenCL which SDK is best?

I am a beginner in OpenCL programming. My PC has windows 8.1 with both intel graphics and AMD Radeon 7670. When I searched to download an OpenCL SDK and sample helloworld programs, I found that there are separate SDKs and programs in entirely different formats available. I have to use C not C++. Can anyone suggest which SDK I should install? Please help.
At the lowest level, the various OpenCL SDKs are the same; they all include cl.h from the Khronos website. Once you've included that header you can write to the OpenCL API, and then you need to link to OpenCL.lib, which is also supplied in the SDK. At runtime, your application will load the OpenCL.dll that your GPU vendor has installed in /Windows/System32.
Alternatively, you can include cl.hpp and use the C++ wrapper, but since you said you're a C programmer, and because most of the books use the C API, stick with cl.h. I think this might account for the "programs in entirely different formats" observation you made which is why I bring it up here.
The benefit of one SDK over another typically is for profiling and debugging. The AMD SDK, for example, includes APP Profiler (or now CodeXL) which will help you figure out how to make your kernels faster. NVIDIA supplies Parallel Nsight for the same purpose, and Intel also has performance tools.
So you might choose your SDK based on the hardware in your machine, but understand that once you've coded to the OpenCL API, your application can run on other GPUs from other vendors -- that is the benefit of OpenCL. You should even be able to get samples from one vendor to execute on hardware from another.
One thing to be careful of is versions: If you code to an OpenCL 1.2 SDK you might not run on OpenCL 1.1 hardware.
For me the best thing with OpenCL is that you do not need an SDK at all because it abstracts different Vendor implementations behind a common Interface (see Answer in this Thread: Do I really need an OpenCL SDK?).

Compile libcivil for ARM architecture

i coded a java applications that takes the pictures of a webcam that is attached to the pc. For that i use the lti-civil java-api. It works fine! This api uses a shared library -libcivil.so- for jni access to several native libs. The libcivil.so exists for linux 32/64bit osx and windows. But i want the application to run with raspberry pi which has arm-architecture.
My question is: is it possible to recompile the libcivil - shared lib for arm-architecture? iam not familiar with c++ so i don't know if it is possible in any way.
i found a way to obtain webcam images with java on a raspberry pi. I use the v4l4j library. It's a jni wrapper for the v4l2 api. It handles direct access to the /dev/video interface under linux. There is a way to compile it for the raspbian linux-port and it works great. But the raspberry seems to be too slow (5-8 fps and hight latency - about 300-500ms). But this is another thing. Now iam waiting for the hackberry or gooseberry... =)
compile v4l4j on raspberry pi how-to:
https://code.google.com/p/v4l4j/wiki/GettingStartedOnRPi
greez
daniel

USB modem device software in cisco routers using C

HI all,
I am a final year computer science student; my project for final year is to develop a software using C or Tcl, for a CISCO router. In the latest series of routers, cisco has given a USB port for mass storage.
Now I want that if I plug-in a wireless modem like Idea netsetter (a modem available in India with this name), the router should connect to the internet.
Tell me any basic ideas regarding this project. Also, if there is any other language in which it can be developed more easily, please suggest.
When you say "develop a software using C or Tcl, for a CISCO router", do you mean that you are writing a custom firmware from scratch? Or are you wanting to write some sort of plug-in or application that interfaces with the existing firmware?
In either case, I would recommend that you first consult the documentation you have for the router. See what kind of API and driver support you have for the C and TCL languages. If one language looks like it is better supported than the other, then you will likely have an easier time using that language.
In my experiences, it is typically easier to do systems-level programming in C than in TCL. Most embedded systems assume that you are going to work in C and provide C-language interfaces to system functions. You didn't mention anything about the router model, so I can't say anything too specific.

Resources