bkpmind Just some notes

12Jan/111

Error during SystemC compilation

I'm using Linux Mint 10 / Ubuntu 10.10 and I was getting an error during SystemC compilation. The error was:

make[3]: Entering directory `/home/sergio/a/systemc-2.2.0/src/sysc/utils'
g++ -I. -I. -I. -I../../../src    -Wall -DSC_INCLUDE_FX -O3 -c -o sc_utils_ids.o `test -f 'sc_utils_ids.cpp' || echo './'`sc_utils_ids.cpp
sc_utils_ids.cpp: In function ‘int sc_core::initialize()’:
sc_utils_ids.cpp:110: error: ‘getenv’ is not a member of ‘std’
sc_utils_ids.cpp:111: error: ‘strcmp’ was not declared in this scope
sc_utils_ids.cpp: At global scope:
sc_utils_ids.cpp:119: warning: ‘sc_core::forty_two’ defined but not used
make[3]: *** [sc_utils_ids.o] Error 1
make[3]: Leaving directory `/home/sergio/a/systemc-2.2.0/src/sysc/utils'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/sergio/a/systemc-2.2.0/src/sysc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/sergio/a/systemc-2.2.0/src'
make: *** [all-recursive] Error 1

I found a solution at Fedora Forum (thanks to YamlaJ user).
Edit systemc-2.2.0/src/sysc/utils/sc_utils_ids.cpp file adding these two includes:

#include "string.h"
#include "cstdlib"

Now you can proceed with make ; make install and test with:

cd examples/sysc/rsa
make check
11Jan/110

Bluespec Syntax Highlighting for Vim

Here goes a little tip for those who like to use Vim editor to program in Bluespec but gets bored with all your code in gray lines.

Just copy the directory structure inside of $BLUESPEC_HOME/util/vim/ to your home .vim directory (~/.vim) to get syntax highlighting working for bsv files.

mkdir ~/.vim   # Only if you don't have vim directory yet.
cd $BLUESPEC_HOME/util/vim/
cp -r * ~/.vim

Now you don't need to load Bluespec Workstation just to get some color in Vim editor ;)

11Jan/110

Just an example in how to use gnuplot

Just an example in how to use gnuplot

gnuplot> set yrange [50:70]
gnuplot> plot "./out.txt" using 2:4 title 'Signal 1' with lines, \
> "./out.txt" using 2:5 title 'Signal 2' with lines
gnuplot> set yrange [58:62]
gnuplot> replot
Tagged as: No Comments
10Jan/110

Timer Bash Script

I've used this script to wait a download (through Firefox or Chromium) finishes then shutdown my PC.

while true
  do
   sleep 10;
   if [ ! -e YourFile.zip.part ] ; then init 0; fi
  done
Tagged as: , , No Comments
9Jan/110

Embedded Systems

That is what we could call an "embedded system" ;)

Source: Google Images

Source: Google Images

9Jan/110

MySQL command line backup and restore

Backup:

$ mysqldump -u root -p -v DB_NAME > BkpDec2010.sql

Restore:

$ mysql -u root -p DB_NAME < BkpDec2010.sql

To create a database:

$ mysqladmin -u root -p create DB_NAME
9Jan/110

Putting the USB Blaster to work on Linux

You'll need to edit rc.local file and create a new one in udev rules:

1) edit rc.local (sudo vi /etc/rc.local) and append the following lines before "exit 0" line.

mount --bind /dev/bus /proc/bus
ln -s /sys/kernel/debug/usb/devices /proc/bus/usb/devices

2) create altera-usb-blaster.rules file (sudo vi /etc/udev/rules.d/altera-usb-blaster.rules) with this line:

ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="666"

For more information about this fix:

http://www.philpem.me.uk/elec/fpga/quartus-ubuntu/

EDIT1: To check if it's working properly execute jtagconfig. You can found it inside Quartus bin folder. If necessary, sudo killall jtagd.

EDIT2: There's an alternative to put usb blaster working on Linux. I've got this tip on Altera Forum but I have not tested yet.

sudo ln -s /sys/kernel/debug/usb/devices /dev/bus/usb/devices
sudo vim <altera path>/quartus/linux/jtagd
:%s/\/proc\/bus\/usb\/%03u\/%03u/\/dev\/bus\/usb\/%03u\/%03u\n/
:%s/\/proc\/bus\/usb\/devices/\/dev\/bus\/usb\/devices\n/
:wq
sudo vim <altera path>/quartus/linux64/jtagd
:%s/\/proc\/bus\/usb\/%03u\/%03u/\/dev\/bus\/usb\/%03u\/%03u\n/
:%s/\/proc\/bus\/usb\/devices/\/dev\/bus\/usb\/devices\n/
:wq
9Jan/110

Altera Quartus II 10.0 installation

Version 10.0 of Altera's products crash during installation on Linux environment. The workaround is to remove the file libX11.so.6 before starting the installer. So, follow this steps:

1) bash ./10.0_quartus_free_linux.sh --noexec
2) cd 10.0_quartus_free_linux
3) rm altera_installer/bin/libX11.so.6
4) sudo bash ./setup

PS: Step 1 is to decompress all installer files.

EDIT: if you got error on step 4, type:  sudo -i; export DISPLAY=:0.0; ./setup

For more detailed information go to

http://www.philpem.me.uk/elec/fpga/quartus-ubuntu/