Soundcloud API test.

I’m planning to develop a web application to search for free music and stream it online from various sites.

The first one I thought about was soundcloud that gives you access to their APIs here.

So I just pulled up this little python script to test it out.

It uses the soundcloud-python package wich is downloadable with pip or easy_install.

pip install soundcloud

easy_install soundcloud

just edit the client_id='YOUR_CLIENT_ID' line with the actual client ID. And try it out with a random track, pretty easy. Check the terms of use, of course.

More to go :)

Posted in music, Projects | Tagged , , | 2 Comments

2012 in review

I folletti delle statistiche di WordPress.com hanno preparato un rapporto annuale 2012 per questo blog.

Ecco un estratto:

600 people reached the top of Mt. Everest in 2012. This blog got about 3.400 views in 2012. If every person who reached the top of Mt. Everest viewed this blog, it would have taken 6 years to get that many views.

Clicca qui per vedere il rapporto completo.

Posted in Uncategorized | 1 Comment

Cool tutorial for stellaris launchpad on linux

You can find right here a good tutorial on how to setup a working environment for the stellaris launchpad board on GNU/linux (debian).

The cool thing this uses eclipse and open ocd to debug a project right in eclipse! I can’t wait to try this out!

Be sure to have a look at it!

Posted in Uncategorized | Tagged , , , | Leave a comment

Wow

Really! Wow! I’ve got mentioned on dangerous prototypes and hack a day!

Here and here!

Posted in Uncategorized | Tagged , , | Leave a comment

Debugging a program on the stellaris launchpad board

OpenOCD now supports TI’s stellaris launchpad. Patching it it’s no longer necessary!
The source it’s available here!

After creating a template for the Stellaris Launchpad, I wanted to debug it and my own programs as well.

So I installed openOCD and used gdb (for arm-none-eabi) to debug it and see if it works properly.

I writing here a tutorial to help someone who would like to do the same.

The first thing to do it’s obtaining a compile toolchain, I’m lazy and I use the arm-none-eabi from Codesourcey that’s already built from them and free to use as I described it here.

When you got that working the next step it’s getting the Stellarisware software, the process it’s described here too. (It’s not really needed, but if you want to do something quickly that’s the way to go because the API for it it’s well documented and easy to use).

After doing the previous steps you need to get the source code of openOCD, patch it and build it. You can find how all this born in (this forum topic).

You’ll need git, which you can get on Ubuntu just opening a terminal and typing:

sudo apt-get install git-core

You need to get the latest openOCD source code so type on the terminal:

cd ~/stellaris/
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd

This will create a directory called openOCD containing all the source files of the project. then you need to install the libraries you’ll need to built it. So again type in the terminal:

sudo apt-get install libtool autoconf texinfo libusb-dev

This tutorial will just focus on the Launchpad board, you’d probably need other libraries if you need to build openOCD for other dongles.

The next step it’s to patch the sources with the latest patch from this archive (thanks Spencer Oliver). The process it’s quite easy and you can choose different methods to do it, I’ll go for the git pull to the project so type:

git pull http://openocd.zylin.com/openocd refs/changes/22/922/10

And git will automatically patch the sources with the latest patch revision.

Then you’ll need to build openOCD, there are plenty of information on the README file, basically I just did this:

cd openocd
./bootstrap
./configure --enable-maintainer-mode  --enable-ti-icdi
make

I skipped the “make install” step.

I then created a directory with the binary file and all the other configurations needed:

cd ~/stellaris
mkdir openocd-bin
cp -r ./openocd/tcl/* ./openocd-bin
cp ./openocd/src/openocd ./openocd-bin

Then you’ll need a .cfg file to pass the openOCD, I used the one this guy made, because I’m lazy (haven’t I told you?). So just make a file called LM4F120XL.cfg in the openocd-bin folder and copy the following in it:

# TI Stellaris Launchpad ek-lm4f120xl Evaluation Kits
#
# http://www.ti.com/tool/ek-lm4f120xl
#
#
# NOTE: using the bundled ICDI interface is optional!
# This interface is not ftdi based as previous board were
#
source [find interface/ti-icdi.cfg]
set WORKAREASIZE 0x4000
set CHIPNAME lm4f120h5qr
source [find target/stellaris_icdi.cfg]

Now a quick check, the openocd-bin folder should contain the following files:

bitsbytes.tcl
board
chip
cpld
cpu
interface
LM4F120XL.cfg
memory.tcl
mem_helper.tcl
mmr_helpers.tcl
openocd
target
test

Now you’re ready to launch it from here with sudo, connect the board to a USB port and just type in the command line:

sudo ./openocd --file ./LM4F120XL.cfg

Now that you’ve got it running open another terminal to download a template project I made, to run it on the board and debug it! So type:

cd  ~/stellaris
mkdir projects
cd projects
git clone https://github.com/scompo/stellaris-launchpad-template-gcc.git

This will clone the project into the stellaris-launchpad-template-gcc folder. You just need to open up the Makefile with any editor and change this:

# Stellarisware path
STELLARISWARE_PATH=~/stellaris/stellaris/

With the path to your stellarisware main folder. Then you can just build your project typing:

make

Then comes the cool part of the process, see if the program it’s running properly, so just connect arm-none-eabi-gdb to open ocd, load the program and see if everything it’s good!

arm-none-eabi-gdb main.axf

This will open up gdb for arm-none-eabi with a target file called main.axf. Next will type to the (gdb) prompt, so let’s do something useful (Again thanks a lot the the stellaristi forum guys for this)!

target extended-remote :3333
monitor reset halt
load
monitor reset init

Now the target processor it’s halted at the beginning of the startup_handler() code of the LM4F_startup.c file. Supposedly this will work fine doing it’s magic, but check it out, and if you find any strange behavior just tell me opening an issue in the github project page. So let’s go on and just set some breakpoints and display some the variables at each break.

b main.c:51
b Timer1A_ISR
display count
c

The c command will just continue the execution of the program from the breakpoint. If you need any help just type help in the gdb prompt window.

Everytime you’ll write c to continue executing the program you’ll see that the variable count will be updated, so basically the interrupt routine it’s running and updating the volatile variable. Well, we’re good then!

To exit gdb just enter “q” and confirm with “y”.

To exit from openocd just use “ctrl”+c like every command line program in linux. I’ve noticed that I need to disconnect and riconnect the board sometimes to restart openOCD so if it’s the case, just go for it doing this.

This would hopefully be a starting point for your own projects, just copy this template folder and start doing everything you want! Good hacking!

Posted in Projects, stellaris | Tagged , , , , , , , | 25 Comments

Updated free makefile, linker script and low level code

I pushed some changes to https://github.com/scompo/stellaris-launchpad-template-gcc .
I basically fixed some compile warnings, cleaned up the makefile (thanks wollow) and used a dinamic stack allocation.

Posted in Projects, stellaris | Tagged , , , , , , | 4 Comments

A lot of stuff learned!

I’ve been playing around a lot with the Stellaris Launchpad board, looking around the stuff I never noticed that the besides the fact of being licensed with a BSD style license, the Stellarisware SW provided by Texas Instruments has a closed license for the various examples.

The basic files needed to create a program for the board, and basically for all the ARM processors are the following with binutils and gcc:

  • The program you want contained in a .c file.
  • A linker script due to the fact you don’t have an operating system running.
  • A startup code file that zeroes the .bss segment variables, copies the .data segment to ram and setups the NVIC vector table.
  • A Makefile to build everything easily.

The program and the Makefile can be done with not much worries, but the linker script and the startup code are quite difficult, at least for me, to understand and set up properly.

So I ended up building from scratch the whole files needed and licensed them with a BSD license (Basically, do what you want with them, just give me credit I’m happy if someone find them useful, you can contribute, but don’t blame me if it doesn’t work lol)

You can find them in this Github repository

Continue reading

Posted in Projects, stellaris | Tagged , , , , , , , , , , , , , | 5 Comments

Stellaris launchpad first project

I played with the stellaris launchpad and gcc today.

I basically created a folder in /stellaris/boards called myProjects copied the uart_echo example in the /stellaris/boards/ek-lm4f120xl.

You just need this files to work with gcc via command line:

  • uart_echo.c
  • startup_gcc.c
  • uart_echo.ld
  • Makefile

I changed the names of uart_echo.c and uart_echo.ld to something more convenient like serialADC and changed inside the Makefile all the names from “uart_echo” to “serialADC” at once.

I used the api called uartstdio.h so I needed to add the compilation of the object file uartsdio.o to the makefile rule.

Well, it has been cool, now going for something nicer to do! You can find all the source code files right here!

Posted in stellaris | Tagged , , | 2 Comments

Stellaris Launchpad

So, I got my 2 stellaris launchpad boards from TI.

Launchpad

Stellaris Launchpad

Each board has 2 Stellaris LM4F120H5QR ARM Cortex-M4 MCUs. The nice thing it’s I’ve had them for less than 5$ with free shipment.

I’ve followed the getting started tutorial on a windows machine, as they suggested, using their Code Composer Studio 5, which is free for the launchpad board, with now limitation on code size or time.
I’ve noticed that the examples can be built with a GNU cross-toolchain for arm-none-eabi, like the codesourcery lite if you don’t want to build your own (Yeah, I’m lazy).
I just used my ubuntu pc to test that out, and it was kinda easy to build some sample!

First thing to do it’s downloading the toolchain from here, you’ll need to register on their site. The installation it’s pretty straightforward, just follow the instructions on the site, with the shell change and the adding of the bin directory to the path.

You can verify to have a working toolchain with this test:

arm-none-eabi-g++ –version

Next you need to download the StellarisWare software from here you’ll need to register in here too but also getting an approval.

After downloading the StellarisWare you should create a folder on your home directory:

cd
mkdir stellaris
cd stellaris

Then you just need to run unzip to extract inside your folder the content of the auto-extracting archive you downloaded.

unzip ../downloads/SW-EK-LM4F120XL-9453.exe

Then you’ll just have everything ready to work with that. Get inside a directory and just use make to build the project. The cross compiling and all the variables configurations are in the makedefs file in the stellarisware folder!

The only missing part until now it’s how you load to the compiled bin file into the microcontroller. On windows it can be achieved with the LMLoader program. In linux there’s no way at the moment usually with the ICDI controller on board, the only way it’s using a JTAG adapter connected on the breakout JTAG connector.

The nice thing it’s that there’s also a d DFU Bootloader on the chip, maybe with some work I could get it working and uhm that would be useful somehow.

Posted in stellaris | Tagged , , , , , | 3 Comments

timeTable

I’m fed up with the transportation service of my city, it’s slow and it gives no clue about what bus to catch when you need to go somewhere.

I’m planning to do a web application to use with it and I’m developing a website in Django/Python to implement the timetable with a search for routes.

The final goal will be to put a “I’m here” button which would tell the nearest stop and tell you the next useful bus to catch.

After learning a bit of Python to work with the Tumblr API I’ve noticed that it’s a quite nice web oriented language to use, so I choose it in combination with the Django project and programming dynamic web pages it’s not as bad as I remembered from high school. :)

You can find if you want the source files in this Bitbucket repository!

Posted in Projects, solarPower, timeTable | Tagged , , , , , | Leave a comment