-
Notifications
You must be signed in to change notification settings - Fork 3
NanoKong Installation Guide
For a more detailed installation guide. Please look at here
- JDK
- Ant
- Arduino toolchain(http://arduino.cc/playground/Linux/Ubuntu)
- avr-gcc
- avrdude
- USBTiny compatible device.
The USBTiny is a USB dongle which can program the Flash at Arduino device by using the SPI interface. It can be attached to the ICSP header and program the internal Flash in the AtMega chip. This is required if we want to install the NanoKong bootloader.
Please don't use the arduino package directly since it is way behind. Please download and install the toolchain and arduino IDE from the arduino site instead.
In addition, we need to install ant which is required to compile the NanoKong utilities.
Please download the code from the git://github.com/nielsreijers/NanoKong.git
# git clone git://github.com/nielsreijers/NanoKong.git
# cd nanovmtool
# ant
In order to build the NanoKong in the ARduino Mega2560 # cd vm/build/avr_mega2560 # make
You can find the NanoVM_eeprom.hex, NanoVM.hex and NanoVM_NRWWsection.hex. The first one is the EEPROM image which contain the default program. The second one is the NanoKong VM itself. The third one is the bootloader which is required to download and install code into the Flash.
The NanoKong VM can be downloaded into the arduino board by the arduino bootloader. The avrdude can be used to do this job.
# avrdude -V -p atmega2560 -P /dev/ttyS0 -c stk500v2 -U flash:w:NanoVM.hex -U eeprom:w:NanoVM_eeprom.hex
If we want to download the Java bye code via the ZWave/Zigbee and written it to the Flash, we need to install the NanoKong loader to replace the arduino bootloader. This boot loader is compatible with the original arduino bootloader so that we can still use your board inside the Arduino IDE.
# cd tools/arduino-stk500v2-bootloader
# make
We can use the original Arduino bootloader to install the NanoKong bootloader. The bootloader must be installed in the following steps. Firstly, we need to enable the write permission of the bootloader sector. It is disable by default for the safety issue.
# avrdude -p atmega2560 -P usb -c usbtiny -e -U lock:w:0x3F:m -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m
Secondly, we can burn the NanoKong bootloader
# avrdude -p atmega2560 -P usb -c usbtiny -D -V -U flash:w:../../../tools/arduino-stk500v2-bootloader/stk500boot_v2_mega2560.hex:i
Third, we need to install the Flash programmer which can be executed in the runtime to change the Flash content. The Atmega divide the Flash into two parts so that we can program the Flash while we read instructions from it. The Flash programmer is located in the NRWW section of the Flash which is readable when we program the Flash.
# avrdude -p atmega2560 -P usb -c usbtiny -D -V -U flash:w:NanoVM_NRWWsection.hex:i
Finally, we should disable the write permission.
# avrdude -p atmega2560 -P usb -c usbtiny -U lock:w:0x0F:m -U hfuse:w:0xD0:m