Month: May 2015

Fixing aclocal-1.4 error

I was trying to compile portfwd-0.29 but was getting this error message:

$ make
cd . && /comum/workspace/portfwd-0.29/config/missing aclocal-1.4
WARNING: `aclocal-1.4' is needed, and you do not seem to have it handy on your
         system.  You might have modified some files without having the
         proper tools for further handling them.  Check the `README' file,
         it often tells you about the needed prerequirements for installing
         this package.  You may also peek at any GNU archive site, in case
         some other package would contain this missing `aclocal-1.4' program.
Makefile:104: recipe for target 'aclocal.m4' failed
make: *** [aclocal.m4] Error 1

Then I fixed it using autoreconf command:

$ autoreconf -f -i
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:5: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.in:5: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.in:8: installing 'config/compile'
Makefile.am: installing './INSTALL'
Makefile.am: error: required file './NEWS' not found
Makefile.am: error: required file './AUTHORS' not found
Makefile.am: error: required file './ChangeLog' not found
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
getopt/Makefile.am: installing 'config/depcomp'
src/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/Makefile.am:1: warning: 'CFLAGS' is a user variable, you should not override it;
src/Makefile.am:1: use 'AM_CFLAGS' instead
src/Makefile.am:2: warning: 'CXXFLAGS' is a user variable, you should not override it;
src/Makefile.am:2: use 'AM_CXXFLAGS' instead
tools/Makefile.am:2: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
tools/Makefile.am:1: warning: 'CXXFLAGS' is a user variable, you should not override it;
tools/Makefile.am:1: use 'AM_CXXFLAGS' instead
autoreconf: automake failed with exit status: 1

Oops, the software author forgot to create the files NEWS, AUTHORS, ChangeLog, I will create empty files to satisfy autoreconf:

$ touch NEWS
$ touch AUTHORS
$ touch ChangeLog

Let me to try again:

$ autoreconf -f -i
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:5: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.in:5: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
src/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/Makefile.am:1: warning: 'CFLAGS' is a user variable, you should not override it;
src/Makefile.am:1: use 'AM_CFLAGS' instead
src/Makefile.am:2: warning: 'CXXFLAGS' is a user variable, you should not override it;
src/Makefile.am:2: use 'AM_CXXFLAGS' instead
tools/Makefile.am:2: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
tools/Makefile.am:1: warning: 'CXXFLAGS' is a user variable, you should not override it;
tools/Makefile.am:1: use 'AM_CXXFLAGS' instead

Great, worked like a charm!

My J-Link EDU updated

$ JLinkExe
SEGGER J-Link Commander V4.98e (‘?’ for help)
Compiled May 5 2015 11:49:39
Updating firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Replacing firmware: J-Link ARM V8 compiled Nov 25 2013 19:20:08
Waiting for new firmware to boot
New firmware booted successfully
DLL version V4.98e, compiled May 5 2015 11:49:35
Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware: V8.00
S/N: 26XXXXXXX
OEM: SEGGER-EDU
Feature(s): FlashBP, GDB
VTarget = 0.000V
J-Link>

Analyzing CONFIG_ in the code not defined in Kconfig

Verify if a list of CONFIG_BLABLABLA is defined in the Kconfig. Just put the BLABLABLA in the configs_not_in_kconfig.txt each one in a line and then execute:

$ for i in $(cat listing_all_configs.txt); do find . -name Kconfig | xargs egrep -e "config\s$i" ; done

Listing all CONFIG_ that doesn’t exist in the Kconfig:

$ for i in $(cat listing_all_configs.txt); do find . -name Kconfig | xargs egrep -e "config\s$i" 2>&1 > /dev/null ; if [ $? -eq 0 ]; then echo "" ; else echo $i ; fi ; done > configs_not_in_kconfig.txt

Como remover os caracteres das linhas de um arquivo antes de uma determinada palavra

Após executar o comando “uniq -c” num arquivo com numa lista com milhares de CONFIG_BLABLABLA_BLABLABLABLA eu obtive um novo arquivo mostrando quantas vezes cada CONFIG_… repetida existe.

Então agora preciso remover estes valores e todos os caracteres que antecedem o config em si. Para fazer isso basta usar o comando “sed” desta forma:

cat arquivooriginal.txt | sed 's/^.*CONFIG_/CONFIG_/' > arquivosomenteconfig.txt

Fonte: http://www.unix.com/unix-for-dummies-questions-and-answers/98893-how-delete-all-character-before-certain-word.html

Using OpenOCD and gdb to debug my NuttX port to LPC11xx

I’m porting NuttX to LPC11xx (using the LPCXpresso LPC1115 board) and these are the steps I used to get OpenOCD and GDB working to debug my firmware:

The openocd.cfg to use with STLink-v2 SWD programmer:

# LPC1115 LPCXpresso Target

# Using stlink as SWD programmer
source [find interface/stlink-v2.cfg]

# SWD as transport
transport select hla_swd

# Use LPC1115 target
set WORKAREASIZE 0x4000
source [find target/lpc11xx.cfg]

You need to execute “reset halt” from OpenOCD telnet server to get “monitor reset halt” working on gdb:


$ telnet 127.0.0.1 4444
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Open On-Chip Debugger

> reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0x1fff0040 msp: 0x10000ffc

> exit

Now execute the command arm-none-eabi-gdb (from Debian/Ubuntu package “gdb-arm-none-eabi”) passing the nuttx ELF file:

$ arm-none-eabi-gdb nuttx
GNU gdb (7.7.1+dfsg-1+6) 7.7.1
Reading symbols from nuttx...done.

(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x1fff0040 in ?? ()

(gdb) monitor reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0x1fff0040 msp: 0x10000ffc

(gdb) load
Loading section .vectors, size 0xc0 lma 0x0
Loading section .text, size 0x9197 lma 0x410
Loading section .ARM.exidx, size 0x8 lma 0x95a8
Loading section .data, size 0x48 lma 0x95b0
Start address 0x410, load size 37543
Transfer rate: 9 KB/sec, 6257 bytes/write.

(gdb) b __start
Breakpoint 1 at 0x410: file chip/lpc11_start.c, line 109.

(gdb) step
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, __start () at chip/lpc11_start.c:109
109	{

(gdb) 
115	  lpc11_clockconfig();

(gdb) 
lpc11_clockconfig () at chip/lpc11_clockconfig.c:93
93	  putreg32(SYSCON_SYSPLLCLKSEL_IRCOSC, LPC11_SYSCON_SYSPLLCLKSEL);

(gdb) 
96	  putreg32((SYSCON_SYSPLLCTRL_MSEL_DIV(4) | SYSCON_SYSPLLCTRL_PSEL_DIV2), LPC11_SYSCON_SYSPLLCTRL);

(gdb) p /x *0x40048008      <--- this is the LPC11_SYSCON_SYSPLLCTRL register address
$2 = 0x23
(gdb) 

You can use breakpoints, steps and many other GDB features.

That is it!

HTML5 visualization and graphic toolkit

I am looking for some HTML5 graphic toolkit for data visualization.

The idea is creating something similar to Freeboad, but more evolved, I mean: more type of data visualization and UI components.

Almost all data visualization are based on D3 or Graphite.

Dashing:
http://dashingdemo.herokuapp.com/sample
http://shopify.github.io/dashing/

GDash:
https://github.com/ripienaar/gdash

Graph-explorer:
https://github.com/vimeo/graph-explorer/wiki

Graphana:
http://grafana.org

Graphene:
http://jondot.github.io/graphene/
https://github.com/jondot/graphene

jCharFX:
https://github.com/softwarefx/jChartFX

justGauge:
https://github.com/toorshia/justgage

Limn:
https://github.com/wikimedia/limn

Node-RED: (used to create component relationship/integration)
http://nodered.org

Raphaël:
http://raphaeljs.com/chart.html

Tasseo:
https://github.com/obfuscurity/tasseo

Flashing NuttX on STM32F429i-Disco board

This is my openocd.cfg file:

# STM32F429i-Disco

# Using stlink as SWD programmer
source [find interface/stlink-v2.cfg]

# SWD as transport
transport select hla_swd

# Use STM32F4x target
set WORKAREASIZE 0x4000
source [find target/stm32f4x.cfg]

Just connect miniUSB cable to STM32F429i-Disco board and execute:

$ sudo openocd -f openocd.cfg

Now using telnet to connect on openocd server execute:

$ telnet 127.0.0.1 4444
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Open On-Chip Debugger

Previous state query failed, trying to reconnect
jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 6300ms

> reset halt
Previous state query failed, trying to reconnect
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800051c msp: 0x2000439c
Polling target stm32f4x.cpu succeeded again, trying to reexamine
stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints

> flash probe 0
device id = 0x10036419
flash size = 2048kbytes
flash 'stm32f2x' found at 0x08000000

> flash write_image erase nuttx.bin 0x08000000
auto erase enabled
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x20000042 msp: 0x2000439c
wrote 65536 bytes from file nuttx.bin in 2.970617s (21.544 KiB/s)

> reset run
jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 100ms

> exit

That is all!