Building Source Code on Raspberry Pi - c

This is probably a stupid question, but I have been pouring over forums and google for hours and I can't figure this out.
I recently downloaded the mame4all source repository from here
https://code.google.com/p/mame4all-pi/
and made a few edits to the list of games that are available. Now I am having issues compiling/building the source. In the repository, there is of course the source code (Contained in an src folder). I cannot figure our how to build/install the source code now that I have edited it. In the main folder there is a makefile.rpi file, makefile.gp2x, and makefile.rpi.debug, I feel like there is something that I need to do with these but I am not entirely sure
I am not sure how to build/compile this source code to test the changes, I am on a raspberry pi using Raspbian Wheezy. I feel like I am missing something simple, any help is greatly appreciated!

You need build tools for ARM architecture installed within the Raspbian Wheezy. But compiling in Raspberry Pi is horribly slow and you might want to do it on your PC instead. If you have a Debian on Ubuntu installation on your PC, then get ARM tool chain that can 'cross-compile' from x86 to ARM. I am sure there is a version of GCC out there than can do this. A simple Google search might provide more details regarding that. Once you get the binary compiled, copy it to the raspberry pi either via SFTP or by connecting the SD card to your PC.
http://qt-project.org/wiki/RaspberryPi_Beginners_guide contains a lot of information and links to download tools for this purpose. In fact, Qt creator can automate most of the tasks and you can deploy compiled binary directly to the Pi from Qt creator.

Related

Can you open and edit .c files in the Arduino IDE? And subsequently load them to an Arduino board

I have been trying to open c files in the Arduino IDE (which some people claim is possible).
I have not been able to do so.
How can I program the Arduino in c given that I have a project/files in another IDE? (for example, MPLABX)
I am not sure what you are trying to archive. Is it that you want to open it via the Arduino IDE or also compile the source code?
I am not aware of programming in bare c in the Arduino IDE. But if you're looking into using real c code, it might be a good time start either compiling and uploading via terminal yourself, or use an IDE which is suited for development with micro controllers.
I think you can tell the Arduino IDE to more elaborately log outputs. This would tell you exactly the commands the IDE is using (uses avrdude). Then you can use an IDE/Editor of your choice for coding.
Otherwise, have a look at eg. Atmel Studio. They also support Arduino.
There are two answers in one:
If you really want to use the ArduinoIDE you have to have a basic *.ino file having at least the defines and includes which are in the project file and the reqiured setup() loop() usually whats in main in c goes to loop() in ArduinoIDE. Thats the stoney path because there are some specific issues coming from the philosophy behind ArduinoIDE (help makers with little (no?) programming skills to get started quickly).
If you just need the Arduino tool-chain and want to work more comfortable you have two other options:
EclipseIDE with the Sloeber add-on. Download the Sloeber-AllInOne-Package for an easy start and THEN add the other modules you need (like for web development or similar)
PlatformIO an IDE for micro controller development - there is also a cloud based version for testing around.
All mentioned tools are real open source and available cross PC platform and not a gift from a company like MS for probably later lockin of devs

Use Azure IoT Plugin for C within Eclipse

Very new to C, Eclipse, and basically everything else I am trying to work with in this project. I have an Arduino Feather HUZZAH (ESP8266). I have flashed the firmware with the esp_iot_sdk and installed Eclipse on to machine through the unofficial Espressif Dev Kit in order to write the code for the board.
The code I wrote is working well but now I need to find a way to send the collected data to Azure's IoT Hub. I found this plugin for talking to the Azure IoT Hub but cannot figure out how in the world to get it installed using Eclipse.
Even if someone could show me how to get a simple POST request going in C, using a library or not, that would be awesome! Thanks for your help.
So you want to run azure-iot-sdk on ESP8266 with Tensilica Xtensa LX106 MCU.
The first thing you need to do is to port azure-iot-sdk C library to Xtensa platform, using the Espressif Dev Kit toolchain.
Normally, this is officially done by Microsoft. Unfortunately, Xtensa LX106 might not be on the list(roadmap?) yet.
So I think you can do some porting work yourself, following some tutorials from Microsoft. This link works for Linux host, but given that fact that Xtensa toolchain only supports windows for now, you might end up writing some cmd, bat or generic makefile/cmake file, in which you need to have the cross-compile toolchain(aka xtensa-lx106-elf-gcc) specified.
Hopefully, it's not complicated or cumbersome.
After you have done with this, you need some static or dynamic library assembly depending on your settings, the next step is to specify the library path in your eclipse project, and don't forget to include the azure-iot-sdk header folder to your project, as the snapshot shows.
You should be good to go after the above steps.

in-Built linux application with the kernel image or boot.img

how to make an application in built(like top, vi , etc ) so that they can be put inside the /system/bin automatically on flashing the kernel and can be accessed from the command prompt.
I tried modifying the Makefile for the my application by looking at the example of top utility but could not find it under /system/bin .
I am not sure if I have included the sources of the file in the Makefile correctly.
You need to start with something that the manufacturer provided. Presumably it's a devKit or something. Most modern dev kits ship with either a MFG provided development environment, kernel, sources, etc. Many are based on Yocto Linux.
You can't just compile a binary locally on your PC with whatever version of GCC you have and have it work on an embedded environment. Chances are it's a different architecture (ARM or Freescale or something). There are ways to cross-compile but is some setup involved. Read about cross compiling here: http://en.wikipedia.org/wiki/Cross_compiler
There are development and packaging environments that have been developed by the community but it's not for the faint of heart. In short, start reading: https://www.yoctoproject.org/

Cross compiling with existing rootfs and external toolchain (buildroot? qemu?)

I am working on an arm embedded platform based on the Cortex A9, very similar to the hummingboard (http://www.solid-run.com/products/hummingboard/).
I am working on porting over some of our software that was previously running on a beaglebone. Our software is python based but uses some ctypes, an internal c library as well as several python modules and a rabbitmq server. On the beaglebone, setting this up was easy because there is a lot of support and ubuntu based distros that make it simple to install packages.
I have a linaro cross compiler and a uboot and rootfs image given to us by the manufacturer of the platform. Manually cross compiling and building all of our necessary dependencies is turning into quite a headache, as everything has little quirks. I do not have a native development toolchain that can run on the arm device.
I am looking for a simpler way to do some of these tasks. Buildroot sounds like exactly what I need, but I am not sure how I would make it work with an already existing rootfs and toolchain. Unfortunately, I don't know all the details of the rootfs and how the hardware is brought up, so I don't think I can replicate the settings exactly using buildroot.
Another option I was looking into was somehow using the rootfs with QEMU and building a native toolchain to run on it, which would allow me to manually build the dependencies without needing to deal with the headaches of cross compiling.
Any help is very much appreciated. Thanks.
Buildroot is designed to generate an entire rootfs, not to "complement" an existing one. So if you were to use Buildroot, you should get rid of the existing root filesystem, and use the new one generated by Buildroot.
Also, note that if you were happy with the Debian distro running on your BeagleBone, you can also run Debian on your Hummingboard.

Can I somehow use this XDS100v2 JTAG emulator?

I bought a Hawkboard and went looking for a JTAG emulator to use for debugging. The only one I seemed certain about was the Spectrum Digital XDS100v2, because the pins matched and I had read about others using it with a Hawkboard. I had hoped to use a GCC ARM toolchain and OpenOCD, but the XDS100v2 apparently only works with TI Code Composer Studio. I was fine with that, because the Hawkboard uses a TI processor anyway and I figured a TI compiler would be able to optimize really well for it. After I received the JTAG emulator, I installed TI CCSv4...
I absolutely HATE IT.
It has scattered files throughout my hard drive, cluttered up my user directory, is a massive pain in the ass to configure, and now it won't even uninstall properly. I really, really want to just switch to a GCC toolchain and OpenOCD/GDB for debugging, but I can't find any way to do that with the XDS100v2.
There was some recent discussion about this on the OpenOCD mailing list, but it looks like licensing issues prevent the team from including direct support for the XDS100v2. I also found a Git commit made around the same time as the discussion that appears to include code for supporting the XDS100v2, but I don't know if this is official or not. I can't really test it, either, because the XDS100v2 doesn't actually install correctly. I have to install CCSv4 to get the drivers, but I refuse to do this on my other machine because I don't want it to get cluttered like the first one. The discussion mentions that the XDS100v2 is actually just a FTDI device, so I tried using a generic FTDI driver, but Windows didn't recognize it.
I guess what I'm asking is this: Is there some way that I can easily get OpenOCD to support the XDS100v2 by somehow using a generic FTDI driver or another method? I spent $80 on this JTAG emulator and I really hate to let it go to waste.
Getting OpenOCD to work with this will be tricky...
First you need to add the USB IDs of you XDS100v2 to the driver inf file. Please note that
you have to choose between the FTDI drivers and libusb drivers depending how you compiled OpenOCD. If you downloaded a binary OpenOCD version, you should use the drivers shipped with it. Once you added the correct USB Vendor and Product ID to inf file, the driver will install (you have to tell windows the correct path). This step is only needed on Windows platforms.
The device manager will tell you the ID numbers on its "Details" page as "Hardware IDs" Property. Is VID_xxxx and PID_yyyy where xxxx is the Vendor id (VID) and yyyy is the Product id (PID).
Next step is to tell OpenOCD the USB ID (the same you used in the .inf file) - look at other interface/*.cfg files that have the line "interface ft2232". The "layout" is tricky,
just use try-and-error on these.
Final step is to make a complete board definition - look for boards that contain the same or similar cpu chips. If reset does not work, try "reset_config none".

Resources