cd ;//wget http://www.open.com.au/mikem/bcm2835/bcm2835-1.5.tar.gz; //My Pi can't figure out this URLwget http://67.192.60.197/mikem/bcm2835/bcm2835-1.5.tar.gztar xvfz bcm2835-1.5.tar.gz;cd bcm2835-1.5;. /configure ;make ;make install sudo
Monday, January 26, 2015
Install bcm2835 library for the Raspberry Pi
Friday, July 5, 2013
Decode Android APK file to get source code
Author: prankul garg
Procedure for decoding .apk files, step-by-step method:
Step 1:
Make a new folder and put .apk file in it (which you want to decode). Now rename the extension of this .apk file to .zip (eg.: rename from filename.apk to filename.apk.zip) and save it. Now you get classes.dex files, etc. At this stage you are able to see drawable but not xml and java files, so continue.
Step 2:
Now extract this zip apk file in the same folder (or NEW FOLDER). Now download dex2jar from this linkhttp://code.google.com/p/dex2jar/ and extract it to the same folder (or NEW FOLDER). Now open command prompt and change directory to that folder (or NEW FOLDER). Then write
dex2jar classes.dex and press enter. Now you get classes.dex.dex2jar file in the same folder. Then download java decompiler from http://java.decompiler.free.fr/?q=jdgui and now double click on jd-gui and click on open file. Then open classes.dex.dex2jar file from that folder. Now you get class files and save all these class files (click on file then click "save all sources" in jd-gui) by src name. At this stage you get java source but the xml files are still unreadable, so continue.Step 3:
Now open another new folder and put these files
- put .apk file which you want to decode
- download apktool v1.x AND apktool install window (both can be downloaded at the same location) and put in the same folder
- download framework-res.apk file and put in the same folder (Not all apk file need framework-res.apk file)
- Open a command window
- Navigate to the root directory of APKtool and type the following command:
apktool if framework-res.apk apktool d "fname".apk("fname" denotes filename which you want to decode)
now you get a file folder in that folder and now you can easily read xml files also.
Step 4:
It's not any step just copy contents of both folder(in this case both new folder)to the single one
and now enjoy with source code...
Wednesday, March 6, 2013
Install tinyos on Raspberry Pi
source: http://www.mail-archive.com/tinyos-help@millennium.berkeley.edu/msg43109.html
author: Inglezakis Antonios
author: Inglezakis Antonios
You have to install,the following packages from raspbian's repositories first (if they exist). |sudo apt-get install build-essential openjdk-6-jdk openjdk-6-jre python2.7 python2.7-dev automake avarice avr-libc msp430-libc avrdudebinutils-avr binutils-msp430 gcc-avr gcc-msp430 gdb-avr gdb-msp430 subversion graphviz python-docutils git checkinstall
For every needed package than does not exist in raspbian's repositories, you have to build and install it from source code!!!!
|After that, you have to download/clone tinyos source code repository from github
git clone https://github.com/tinyos/tinyos-main.gitBefore the complilation of any example, you also need to install from source nesc compiler.
git clone https://github.com/tinyos/nesc.git cd to nesc source code directory ./configure [--prefix=YOURPREFIXPATH] makemake install ( or sudo checkinstall if YOURPREFIXPATH is in system directory)
example: |mkdir -p $HOME/local/compilers | |./configure --prefix=$HOME/local/compilers | |make | |make install| |export PATH=$HOME/local/compilers/bin:$PATH| Then you have to build tinyos tools from source code: |cd tinyos-main/tools ./Bootstrap ./configure --prefix=$HOME/local/tosTools make all make install (or sudo checkinstall if prefix dir is in system directory)|After that, you need to set some enviroment variables, so that you can build any application
Create the file $HOME/local/tinyos-env.sh #!/bin/bash echo "Setting TinyOs 2 enviroment variables!" export PATH=$HOME/local/tosTools/bin:$PATH export PATH=$HOME/local/compilers/bin:$PATH export TOSROOT=$HOME/local/src/tinyos-2x export TOSDIR=$TOSROOT/tos export MAKERULES=$TOSROOT/support/make/Makerules export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:. export PYTHONPATH=.:$TOSROOT/support/sdk/python:$PYTHONPATH export PATH=$TOSROOT/support/sdk/c:$PATH| Then make it executable: |chmod +x $HOME/local/tinyos-env.sh|and make it to be loaded on every terminal start, for your user. Just add the following lines to the $????/.bashrc file.
|# TinyOS enviroment variables | |source $HOME/local/tinyos-env.sh|Raspberry Pi is an ARM based platform, so every precompiled package for i386 or amd64 architecture fails to be installed.
Have a nice day! Inglezakis Antonios
Monday, March 4, 2013
Enforce software ACK on CC2420 tinyos
cc2420/receive/CC2420ReceiveP.nc:
/*
* The destination address check here is not completely optimized. If you
* are seeing issues with dropped acknowledgements, try removing
* the address check and decreasing SACK_HEADER_LENGTH to 2.
* The length byte and the FCF byte are the only two bytes required
* to know that the packet is valid and requested an ack. The destination
* address is useful when we want to sniff packets from other transmitters
* while acknowledging packets that were destined for our local address.
*/
//--if(call CC2420Config.isAutoAckEnabled() && !call CC2420Config.isHwAutoAckDefault()) {
if( !call CC2420Config.isHwAutoAckDefault()) {
//--if (1) {
//--if (((( header->fcf >> IEEE154_FCF_ACK_REQ ) & 0x01) == 1)
if ( 1
&& ((header->dest == call CC2420Config.getShortAddr())
|| (header->dest == AM_BROADCAST_ADDR))
&& ((( header->fcf >> IEEE154_FCF_FRAME_TYPE ) & 7) == IEEE154_TYPE_DATA)) {
// CSn flippage cuts off our FIFO; SACK and begin reading again
// We may have received an ack that should be processed by Transmit
// buf[rxFrameLength] >> 7 checks the CRC
//--if ( ( buf[ rxFrameLength ] >> 7 ) && rx_buf ) {
if ( rx_buf ) {
cc2420/transmit/CC2420TransmitP.nc:
case S_EFD:
sfdHigh = FALSE;
call CaptureSFD.captureRisingEdge();
//--if ( (call CC2420PacketBody.getHeader( m_msg ))->fcf & ( 1 << IEEE154_FCF_ACK_REQ ) ) {
if ( 1 ) {
/*
* The destination address check here is not completely optimized. If you
* are seeing issues with dropped acknowledgements, try removing
* the address check and decreasing SACK_HEADER_LENGTH to 2.
* The length byte and the FCF byte are the only two bytes required
* to know that the packet is valid and requested an ack. The destination
* address is useful when we want to sniff packets from other transmitters
* while acknowledging packets that were destined for our local address.
*/
//--if(call CC2420Config.isAutoAckEnabled() && !call CC2420Config.isHwAutoAckDefault()) {
if( !call CC2420Config.isHwAutoAckDefault()) {
//--if (1) {
//--if (((( header->fcf >> IEEE154_FCF_ACK_REQ ) & 0x01) == 1)
if ( 1
&& ((header->dest == call CC2420Config.getShortAddr())
|| (header->dest == AM_BROADCAST_ADDR))
&& ((( header->fcf >> IEEE154_FCF_FRAME_TYPE ) & 7) == IEEE154_TYPE_DATA)) {
// CSn flippage cuts off our FIFO; SACK and begin reading again
// We may have received an ack that should be processed by Transmit
// buf[rxFrameLength] >> 7 checks the CRC
//--if ( ( buf[ rxFrameLength ] >> 7 ) && rx_buf ) {
if ( rx_buf ) {
cc2420/transmit/CC2420TransmitP.nc:
case S_EFD:
sfdHigh = FALSE;
call CaptureSFD.captureRisingEdge();
//--if ( (call CC2420PacketBody.getHeader( m_msg ))->fcf & ( 1 << IEEE154_FCF_ACK_REQ ) ) {
if ( 1 ) {
Friday, February 22, 2013
CC2420 CRC verification
This online calculator could do the same CRC calculation as in tinyos:
http://depa.usst.edu.cn/chenjq/www2/SDesign/JavaScript/CRCcalculation.htm
The improved CRC function can be found in tinyos:
/**
* The following implementation computes the same polynomial. It should be
* (much) faster on any processor architecture, as it does not involve
* loops. Unfortunately, I can not yet give a reference to a derivation.
*
* @author Andreas Koepke (porting to tinyos)
* @author Paul Curtis (pointed out this implementation on the MSP430 yahoo mailing list)
*/
uint16_t crc_Byte(uint16_t crc, uint8_t b) {
crc = (uint8_t)(crc >> 8) | (crc << 8);
crc ^= b;
crc ^= (uint8_t)(crc & 0xff) >> 4;
crc ^= crc << 12;
crc ^= (crc & 0xff) << 5;
return crc;
}
uint16_t crc_packet(uint8_t *data, int len) {
uint16_t crc = 0;
while (len-- > 0)
crc = crcByte(crc, *data++);
return crc;
}
http://depa.usst.edu.cn/chenjq/www2/SDesign/JavaScript/CRCcalculation.htm
The improved CRC function can be found in tinyos:
/**
* The following implementation computes the same polynomial. It should be
* (much) faster on any processor architecture, as it does not involve
* loops. Unfortunately, I can not yet give a reference to a derivation.
*
* @author Andreas Koepke
* @author Paul Curtis (pointed out this implementation on the MSP430 yahoo mailing list)
*/
uint16_t crc_Byte(uint16_t crc, uint8_t b) {
crc = (uint8_t)(crc >> 8) | (crc << 8);
crc ^= b;
crc ^= (uint8_t)(crc & 0xff) >> 4;
crc ^= crc << 12;
crc ^= (crc & 0xff) << 5;
return crc;
}
uint16_t crc_packet(uint8_t *data, int len) {
uint16_t crc = 0;
while (len-- > 0)
crc = crcByte(crc, *data++);
return crc;
}
Wednesday, January 9, 2013
How to clear IEEE154_FCF_ACK_REQ to remove the ACK requirement
../cc2420/csma/CC2420CsmaP.nc :
Change line143: header->fcf &= ( (1 << IEEE154_FCF_ACK_REQ) |
to header->fcf &= ( (0 << IEEE154_FCF_ACK_REQ) |
Change line 151: metadata->ack = FALSE;
to metadata->ack = TRUE;
Change line143: header->fcf &= ( (1 << IEEE154_FCF_ACK_REQ) |
to header->fcf &= ( (0 << IEEE154_FCF_ACK_REQ) |
Change line 151: metadata->ack = FALSE;
to metadata->ack = TRUE;
Sunday, January 6, 2013
CC2420 Layer Diagram
- +--------------------------------------------------+
- | Application Layer |
- | |
- +-----------------------+--------------------------+
- +----------------------+-------------------------+
- | Active Message Layer |
- +----------------------+-------------------------+
- +----------------------+-------------------------+
- | Unique Send Layer |
- +----------------------+-------------------------+
- +----------------------+-------------------------+
- | Optional Packet Link Layer |
- +----------------------+-------------------------+
- +----------------------+-------------------------+
- | Optional Low Power Listening Implementations |
- +----------------------+-------------------------+
- +----------------------+-------------------------+
- | Unique Receive Filtering Layer |
- +----------------------+-------------------------+
- +----------------------+-------------------------+
- | Optional 6LowPAN TinyOS Network Layer |
- +----------------------+-------------------------+
- +----------------------+-------------------------+
- | Carrier Sense Multiple Access (CSMA) |
- +----------------------+-------------------------+
- +----------+----------+ +----------+----------+
- | ReceiveP | | TransmitP |
- +----------+----------+ +----------+----------+
- +-----------------------+-------------------------+
- | SPI bus, GPIO, Interrupts, Timer Capture |
- +-------------------------------------------------+
Saturday, January 5, 2013
Install TinyOS 2.1.2 on Ubuntu with gcc-msp430 4.6.3
Source: http://www.electronicspub.com/article/28/tinyos-installation-guide-on-ubuntu.html
Source: http://www.electronicspub.com/articles/articles.print.php?id=28
http://www.eetutorials.com/article/28/1/TinyOS-installation-guide-on-Ubuntu.html
Author: Saeid Yazdani
Date: 13 September 2012
Source: http://www.electronicspub.com/articles/articles.print.php?id=28
http://www.eetutorials.com/article/28/1/TinyOS-installation-guide-on-Ubuntu.html
Author: Saeid Yazdani
Date: 13 September 2012
Thursday, December 6, 2012
Remove cc2420 software CRC check
1*. Modify CC2420TinyosNetworkP.nc in /opt/tinyos/tos/chips/CC2420/lowpan
line 160 -163:
//if(!(call CC2420PacketBody.getMetadata(msg))->crc) {
// return msg;
//}
2. Modify CC2420ReceiveP.nc in /opt/tinyos/tos/chips/CC2420/receive
line 644 -652:
// We may have received an ack that should be processed by Transmit
// buf[rxFrameLength] >> 7 checks the CRC
if (rx_buf ) {
uint8_t type = ( header->fcf >> IEEE154_FCF_FRAME_TYPE ) & 7;
signal CC2420Receive.receive( type, m_p_rx_buf );
post receiveDone_task();
return;
}
3. 2. Modify CC2420ReceiveP.nc in /opt/tinyos/tos/chips/CC2420/receive
line 381:
if( (header.fcf & (1 << IEEE154_FCF_SECURITY_ENABLED)) && (crc << 7) ){
to
if( header.fcf & (1 << IEEE154_FCF_SECURITY_ENABLED) ){
line 160 -163:
//if(!(call CC2420PacketBody.getMetadata(msg))->crc) {
// return msg;
//}
2. Modify CC2420ReceiveP.nc in /opt/tinyos/tos/chips/CC2420/receive
line 644 -652:
// We may have received an ack that should be processed by Transmit
// buf[rxFrameLength] >> 7 checks the CRC
if (rx_buf ) {
uint8_t type = ( header->fcf >> IEEE154_FCF_FRAME_TYPE ) & 7;
signal CC2420Receive.receive( type, m_p_rx_buf );
post receiveDone_task();
return;
}
3. 2. Modify CC2420ReceiveP.nc in /opt/tinyos/tos/chips/CC2420/receive
line 381:
if( (header.fcf & (1 << IEEE154_FCF_SECURITY_ENABLED)) && (crc << 7) ){
to
if( header.fcf & (1 << IEEE154_FCF_SECURITY_ENABLED) ){
Friday, August 17, 2012
Fix ImportError: No module named dateutil.rrule error in MAC 10.8 with Python 2.7.3
When I try to execute python code with import matplotlib, I received following errors:
Traceback (most recent call last):
File "plotPRREachNode.py", line 6, in
import matplotlib.pyplot as pl
File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/pyplot.py", line 26, in
from matplotlib.figure import Figure, figaspect
File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/figure.py", line 19, in
from axes import Axes, SubplotBase, subplot_class_factory
File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/axes.py", line 19, in
import matplotlib.dates as mdates
File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/dates.py", line 122, in
from dateutil.rrule import rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, \
ImportError: No module named dateutil.rrule
The method to solve this error is go to http://labix.org/python-dateutil/#head-2f49784d6b27bae60cde1cff6a535663cf87497b and download the python-dateutil-1.5.tar.gz
Then untar the file and type in command line:
python setup.py install
That's it, wish this could help.
Subscribe to:
Posts (Atom)