flash arduino micro using code::blocks and avr-dude - c

The program I am trying to compile for my arduino micro does not compile in the 'standard' arduino IDE. The reason is subject to a completely different topic discussed at the arduino forum. Cut a long story short, I write pure C and the arduino GUI only does C++. Trust me, I have tried to tweak the interface so it would use avr-gcc, but you enter in an infinite compile - error - refactor loop. I need an other solution.
I am using code::blocks as IDE and want to flash the avr-gcc compiled code onto the arduino micro board using avr-dude on linux kubuntu machine. How would one achieve this?
Problem is I have been running in circles for quite some time now trying to find the correct command line arguments or code:blocks post compiler settings. All information out there is either very old or irrelevant.
I'll keep you posted if I find relevant info

avrdude -V -F -C <avrdude.conf> -p <processor> -P <tty-port> -c stk500v1 -b <baud-rate> -U flash:w:<your-application>.hex
An easy way to see all the settings and get a suitable command line for your system is to use the Arduino gui. Enable verbose upload in the preferences, then program in a basic program like blink. Copy/paste that command line and change the hex file.

I did it here
here
body 24262830

Related

LibFTDI correct compiling / build [ Raspbian ]

INTRODUCTION
Hi everyone, I'm making a project in Raspbian (Raspberry Pi3) using the async streaming feature of the libFTDI library.I first tried to build one of their examples that scans all the ftdi devices inside the Build directory following this guide using cmake and I run perfectly ./find_all getting all the FTDI devices, and that's good.
So I wanted to build a custom libFTDI project in another directory by my own and to compile it by the only compiler tool I know: Gnu C Compiler.
PROBLEM
Well, the compiler shows me no errors when I tried to compile out of the Build directory using a code of mine which has an #include libftdi with gcc -lusb -lftdi AND ./find_all gave me back that there's no device found at all.At this point I toke exactly the same piece of code inside 'find_all.c AND ./find_all STILL gave me back that there's no device found at allObviously before I ran gcc I installed all the libFTDI dependencies via apt-get install, to be more specific:
build-essential
git-core
cmake
doxygen
libusb
libconfude-dev
swig
python-dev
libboost-all-dev
QUESTION
Can anyone help me finding out what's wrong in it?I'd really like to use this wonderful library. I state that I'm a newbie in cmake stuff therefore I guess that even if I'm making a custom project (and not an example) using libFTDI most probably I also have to cmake. I should be grateful if someone explained to me how to cmake/build/gcc this library everywhere I want.
Thanks for the attention payed.

How to remotely run a program on the Jetson TK1 using Nsight Eclipse

I've finished the setup of my jetson tk1 eval board and I've started to setup my Nsight Eclipse to remotely run my programs on the Jetson board.
I've created a CUDA C project in Eclipse and completed the setup and connected my board to my eclipse.
When I build the sample CUDA file locally on eclipse it's working fine but when I try to run on the remote board, I get this output :
echo $PWD'>'
/bin/sh -c "cd \"/home/ubuntu\";export LD_LIBRARY_PATH=\"/usr/local/cuda-
6.0/lib\":\${LD_LIBRARY_PATH};\"/home/ubuntu/test\"";exit
ubuntu#tegra-ubuntu:~$ echo $PWD'>'
/home/ubuntu>
ubuntu#tegra-ubuntu:~$ /bin/sh -c "cd \"/home/ubuntu\";export
LD_LIBRARY_PATH=\" /usr/local/cuda-
6.0/lib\":\${LD_LIBRARY_PATH};\"/home/ubuntu/test\"";exit
/home/ubuntu/test: 1: /home/ubuntu/test: Syntax error: ")" unexpected
logout
From the last line of output, it seems like it's an executable format error. Does anyone ever encountered something similar? I'm running out of ideas.
I managed to find the answer. The version of Eclipse I had wasn't able to correctly compile my cuda file into the ARMv7 format. So I was always uploading an x64_86 format executable file.
My solution was to create a bash script that transfers the cuda file and compile it directly on the board when I launch the run sequence from eclipse.
In the end it took a bit of programming to make things work but it's now compiling and executing correctly on the remote board.
Hello I meet the same problem. I solve these problem by delete the whole workspace and generate a new one. You can have a try.

how to compile a C program in DLX linux in Bochs

I have installed Bochs and DLX linux in it. I wrote a Hello world C program in it. But I don't know how to compile the program in it.
When i type gcc hello.c i get an error saying "bash: gcc: command not found".
Please suggest.
Thanks
DLXLINUX is a very small and a bit outdated distro. Maybe you need to create a certain environment inside the image in order to use gcc and stuff.
Here is a small tutorial teaching how to set a network for it. Maybe after it you can play with it:
http://bochs.sourceforge.net/doc/docbook/user/dlxlinux-networking.html

How do I compile and link the sample code to get a binary?

I'm working with a TI Stellaris LM3S1968. This MCU has an ARM Cortex-M3.
I installed a VM on my laptop with Windows 7 on it, and there I installed GNU Tools for ARM Embedded Processors. Then I installed Stellaris Flash Programmer, GUI and command line. I also installed the Stellaris FTDI Drivers.
Finally, I downloaded and extracted the EK-LM3S1968 Firmware Development Package.
In the extracted folder, there are some examples. One of them is blinky. If I go to /StellarisWare/board/ek-lm3s1968/blinky/gcc/ there's a file called blinky.bin. Using the Stellaris Flash Programmer I can hook it up to my computer and flash it, and it'll work. I tried it with various examples and they all worked.
Now my goal would be to compile the sample code provided in /StellarisWare/board/ek-lm3s1968/blinky/, and to flash it. However, I haven't had much luck, as I'm not very experienced with C or programming microcontrollers.
I copied the LM3S1968 libraries from the StellarisWare folder to the compiler's include folder. Then I followed some examples I found online, but I was not successful. This is what I tried:
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb blinky.c -nostartfile -T blinky.ld -o blinky.o
arm-none-eabi-ld -T blinky.ld -o blinky.out blinky.o
arm-none-eabi-objcopy -Obinary blinky.out blinky.bin
When I flash this .bin file, it doesn't do anything, the LED just stays on.
I think it's because there's a startup_gcc.c file, which handles starting the MCU before running the program. But I'm not sure how to bundle it.
There's a lot of files that are for different IDEs, but they're non-free, so I want to use the GNU tools.
I tried searching here in StackOverflow and Googling around, but I was unable to find an answer.
I believe the linker is discarding the startup code.
A good way to make sure it gets included is using KEEP in your linker script. This will make sure the linker does not discard your startup code. If you don't have your startup code in a section, you need to do that first.

Google-NDK / Compiling command-line C applications without any JNI interaction

Android-NDK is mostly used to write/port native libs which can be called from Java through the JNI mechanism.
I have an ARM based evalboard embedding Android. This evalboard has a serial port so that I can log with a remote terminal on it and then launch commands or other apps ("command line apps" - non Java apps).
I wonder if that is possible with Android NDK to compile "pure" C applications which I will later use as a command on the remote shell? The main idea is to benefit from the toolchain provided by Google-NDK to build code which never interacts with the Dalvik machine.
Best Regards,
Apple92
Hello World C program using Android Toolchain is an article to explain how to compile using android toolchain. I think it useful to you.
Yes, you can compile command line programs using the NDK. If you take a look at any functioning Android system, you'll find many examples of command line programs which have been compiled using that same compiler.
Yes, there is BUILD_EXECUTABLE command, which acts like BUILD_SHARED_LIBRARY but produces an executable.
The trick is the libraries your executable depends upon - they will either need to be on device already (/system/bin) or you will have to upload them with your executable.
I came up with the following script to upload and execute tests:
#!/bin/sh
adb shell rm -r /data/temp
adb shell mkdir /data/temp
for i in dst/*
do
adb push ${i} /data/temp
done
cat <<EOF | adb shell
LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/data/temp
/data/temp/test
exit
EOF

Resources