K20hack
During the development of the new Cortex M4 OpenMote we have been working with the Freescale K20 tower module. In this page we describe the main hacks to run OpenWSN stack on it.
Debug Pins
Port Name | Pin Number | Pin Function |
---|---|---|
PTD7 | Pin B34 | FRAME |
PTB20 | Pin B23 | SLOT |
PTE26 | Pin B25 | FSM |
PTB0 | Pin B27 | TASK |
PTB2 | Pin B29 | ISR |
PTA14 | Pin B35 | RADIO |
SPI to Radio Pins
Port Name | Pin Number | Pin Function |
---|---|---|
PTD0 | B46 | CS0 |
PTD1 | B48 | CLK |
PTD2 | B45 | MOSI |
PTD3 | B44 | MISO |
Other Radio Pins
Port Name | Pin Number | Pin Function |
---|---|---|
PTB3 | B51 | SLPTR |
PTC10 | B52 | RST |
PTE25 | B55 | ISR (IRQ H) |
Bootloader
A Mass Storage Device bootloader has been developed so the k20 mote can be plug into the usb port and appear as a flash drive. In that way, by dropping an application to the folder the mote can be flashed.
In this page some of the considerations to develop applications that can be bootloaded are presented.
Memory Map of the Bootloader
The bootloader is placed at the beginning of the flash area. The memory map looks as follow:
MEMORY { interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000003ff #1024 bytes code (RX) : ORIGIN = 0x00000410, LENGTH = 0x0003FBF0 #all flash except the first 1kb data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x0000FC00 #63kb ram -- 1kb is kept for isr vector in ram. cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x0000010 #16bytes protected area. }
Application Memory Map
Applications that need to be flashed by the bootloader need to define its memory map taking into account that the bootloader is at the beginning of the flash. Basically any application will start at 0xC000
MEMORY { m_interrupts (RX) : ORIGIN = 0x0000C000, LENGTH = 0x000001BC #some space for the interrupt vector m_text (RX) : ORIGIN = 0x0000C800, LENGTH = 0x0003FBF0 #all flash starting after the bootloader m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x0000FC00 #63kb ram -- 1kb is kept for isr vector in ram. m_cfmprotrom (RX) : ORIGIN = 0x0000C400, LENGTH = 0x00000010 #16bytes protected area. }
note that the bootloader and the application may use all the available ram since they will never execute at the same time.
File Types
The bootloader accepts binary, hex and s19 files. For s19 file there is a restriction on the length of s19 records. The limitation comes from the size of the buffers used by the bootloader to write the flash area. We recommend to use -sreclength 40 in the linker script to create the s19 file with s19 records of an appropriate size.