Category: BrainDamage

Running Chronometer demo on STM32LDiscover

Enter inside your NuttX Workspace, i.e.:

$ cd nuttxspace/

Enter inside /nuttx and update it:

$ cd nuttx/
$ git pull

Go to /apps directory and update it:

$ cd ../apps/
$ git pull

Return to /nuttx and clear the repository:
$ cd –
$ make distclean

Configure the stm32ldiscovery to use the chrono board profile:

$ ./tools/ stm32ldiscovery/chrono
Copy files

Compile it:

$ make

Flash the Firmware:

$ openocd -f interface/stlink.cfg -f target/stm32l1.cfg -c init -c “reset halt” -c “flash write_image erase nuttx.bin 0x08000000”

Open other terminal and execute:

$ ./tools/

Return to previous terminal and execute:

$ openocd -f interface/stlink.cfg -f target/stm32l1.cfg

You should see the NuttX Shell starting in the other terminal:

$ ./tools/
==Link Activated

NuttShell (NSH)

Just type “help” or “?” to see if chrono app is there if so run it:

nsh> ?
help usage: help [-v] []

? echo exit hexdump ls mh sleep xd
cat exec help kill mb mw usleep

Builtin Apps:
chrono slcd
nsh> chrono
Opening /dev/slcd0 for read/write access
rows: 1 columns: 6 nbars: 4
max contrast: 7 max brightness: 0
button_daemon: Running
button_daemon: Opening /dev/buttons
button_daemon: Supported BUTTONs 0x01

Non-Linux FOSS

“Linux continues to make headway in embedded devices, but for many devices, it’s just too heavy, and out of the box, it doesn’t have real-time support.

NuttX is a Real Time Operating System (RTOS) for small- to moderate-size embedded systems. It strives to be standards-compliant (POSIX and ANSI) to the fullest extent possible for a deeply embedded environment. NuttX is fully preemptible and includes a filesystem, C library, networking and USB device support.

NuttX has been ported to numerous platforms/architectures ranging from small 8-bit systems, such as the 8052 and the M68HC12, to larger 32-bit systems, such as the ARM Cortex-M3. NuttX can be built with Linux and with Cygwin. Depending on the options that are enabled, NuttX can be squished down to around 20K or so. Around 50K gives you room for a full-featured build.

NuttX was first released in 2007 and is actively developed. It has had 49 releases since then and currently is at version 5.2. NuttX is hosted on SourceForge at and is licensed under a BSD license.”

Thanks these 4 paragraphs in the Linux Jornal I discovered NuttX almost 9 years ago ( ) ! I still enthusiastic about Linux even after 20 years using it, but it was NuttX that took my heart.

I’m talking it because in exactly 7 days (or one week) we will have our first NuttX International Workshop:

See you my friends there!

Flashing NuttX on STM32LDiscovery board

The STM32LDiscovery board is powered by STM32L152R8T6 microcontroller. There is also the STM32L152C-Discovery board, the is exactly the same board but using the STM32L152RCT6 that comes with 256KB Flash and 32KB RAM.

This is the command to flash the nuttx.bin on it:

$ openocd -f interface/stlink-v2.cfg -f target/stm32l1.cfg -c init -c “reset halt” -c “flash write_image erase nuttx.bin 0x08000000”

The serial console is on UART1 (PA9 is TX output and PA10 is RX input) and the baudrate is 57600.

Using rsync to create backup

rsync is mostly used to synchronize files between Internet servers, but this powerful tool also can be used to create local backup.

I have an external harddisk for backup. Instead just using copy command to save my computer file to the external harddisk I want to verify first if the file saved there is exactly the same I have in the computer. Case the files are different I want to save a newer version and rename the older version.

It is easy to do using rsync:

rsync --suffix="_`date +%Y.%m.%d.%H.%M`" -bacH localdirtobackup /media/user/external_harddisk/

If the file exist in the external harddisk, but its content is different then it will be renamed to

It also could interesting to know when some file was corrupted in the computer or external harddisk, or if some virus is changing your files.