From now on the M16c62p code only uses the interrupt stack. The tosthread library would else not work as intended.
Added a fix folder in the Mulle platforms folder. Se README in that folder for more information.
Did a minor fix to the at45db platform specific code regarding the initialization of the chip. The at45db chip is now initialized through the RealMainP software init so that it will be initialized after the mcu.
COMPONENT=TestBlockStorageAppC
-THIS_SUPPORTED_PLATFORMS=tmote telos telosb eyesIFXv1 eyesIFXv2 mica2 mica2dot telosa eyesIFX micaz iris tinynode
+THIS_SUPPORTED_PLATFORMS=tmote telos telosb eyesIFXv1 eyesIFXv2 mica2 mica2dot telosa eyesIFX micaz iris tinynode mulle
ifneq ($(filter $(THIS_SUPPORTED_PLATFORMS) clean,$(MAKECMDGOALS)),)
ifneq ($(filter tmote telos telosb eyesIFXv1,$(MAKECMDGOALS)),)
CFLAGS+=-DUSE_STM25P
endif
- ifneq ($(filter mica2 telosa mica2dot eyesIFX eyesIFXv2 micaz iris tinynode,$(MAKECMDGOALS)),)
+ ifneq ($(filter mica2 telosa mica2dot eyesIFX eyesIFXv2 micaz iris tinynode mulle,$(MAKECMDGOALS)),)
CFLAGS+=-DUSE_AT45DB
endif
You can install TestBlockStorage on a mote via the following command:
make <platform> threads install
-Valid platforms are currently: tmote, telosb, mica2, micaz and iris
+Valid platforms are currently: tmote, telosb, mica2, micaz, iris and mulle
This application first checks the size of the block storage volume, and
erases it. Then, it randomly writes records, followed by a verification
/* Setup the FLG register to some sane defaults. */
ldc #0, flg
- fset u
- ldc #_ustack, sp
+ /* Clear the U flag. This sets the stack pointer to the interrupt stack.
+ This is done so that only one stack is used by both interrupt routines
+ and other code. There would else be a problem when threads are changed
+ in interrupt routines in the tosthread library. */
+ fclr u
/* Setup interrupt vector. */
ldc #%hi16(_vectors_variable), intbh
#Epic specific include directories
THREADS_EPIC_INCLUDE_DIRS = -I$(TOS_THREADS_DIR)/platforms/epic
+#M16c62p specific include directories on tested platforms
+THREADS_M16C62P_DIR = $(TOS_THREADS_DIR)/chips/m16c62p
+THREADS_M16C62P_INCLUDE_DIRS = -I$(THREADS_M16C62P_DIR)
+
+#Mulle specific include directories
+THREADS_MULLE_INCLUDE_DIRS = -I$(TOS_THREADS_DIR)/platforms/mulle
+
#Add CFLAGS for supported platforms
ifneq ($(filter telos telosa telosb tmote,$(MAKECMDGOALS)),)
CFLAGS += $(THREADS_MSP430_INCLUDE_DIRS)
CFLAGS += $(THREADS_CC2420_INCLUDE_DIRS)
CFLAGS += $(THREADS_SHIMMER_INCLUDE_DIRS)
endif
+ifneq ($(filter mulle,$(MAKECMDGOALS)),)
+ CFLAGS += $(THREADS_M16C62P_INCLUDE_DIRS)
+ CFLAGS += $(THREADS_RF230_INCLUDE_DIRS)
+ CFLAGS += $(THREADS_MULLE_INCLUDE_DIRS)
+endif
HplM16c62pAdc = HplM16c62pAdcP;
HplM16c62pAdcP.McuPowerState -> McuSleepC;
+
+#ifdef THREADS
+ components PlatformInterruptC;
+ HplM16c62pAdcP.PlatformInterrupt -> PlatformInterruptC;
+#endif
}
{
provides interface HplM16c62pAdc;
uses interface McuPowerState;
+
+#ifdef THREADS
+ uses interface PlatformInterrupt;
+#define POST_AMBLE() call PlatformInterrupt.postAmble()
+#else
+#define POST_AMBLE()
+#endif
}
implementation
{
__nesc_enable_interrupt();
signal HplM16c62pAdc.dataReady(data);
+ POST_AMBLE();
}
async command bool HplM16c62pAdc.cancel() {
IntPin3.IrqSignal -> IrqVector.IntSig3;
IntPin4.IrqSignal -> IrqVector.IntSig4;
IntPin5.IrqSignal -> IrqVector.IntSig5;
+#ifdef THREADS
+ components PlatformInterruptC;
+ IrqVector.PlatformInterrupt -> PlatformInterruptC;
+#endif
}
provides interface HplM16c62pInterruptSig as IntSig3;
provides interface HplM16c62pInterruptSig as IntSig4;
provides interface HplM16c62pInterruptSig as IntSig5;
+#ifdef THREADS
+ uses interface PlatformInterrupt;
+#define POST_AMBLE() call PlatformInterrupt.postAmble()
+#else
+#define POST_AMBLE()
+#endif
}
implementation
{
M16C_INTERRUPT_HANDLER(M16C_INT0)
{
signal IntSig0.fired();
+ POST_AMBLE();
}
default async event void IntSig1.fired() { }
M16C_INTERRUPT_HANDLER(M16C_INT1)
{
signal IntSig1.fired();
+ POST_AMBLE();
}
default async event void IntSig2.fired() { }
M16C_INTERRUPT_HANDLER(M16C_INT2)
{
signal IntSig2.fired();
+ POST_AMBLE();
}
default async event void IntSig3.fired() { }
M16C_INTERRUPT_HANDLER(M16C_INT3)
{
signal IntSig3.fired();
+ POST_AMBLE();
}
default async event void IntSig4.fired() { }
M16C_INTERRUPT_HANDLER(M16C_INT4)
{
signal IntSig4.fired();
+ POST_AMBLE();
}
default async event void IntSig5.fired() { }
M16C_INTERRUPT_HANDLER(M16C_INT5)
{
signal IntSig5.fired();
+ POST_AMBLE();
}
}
TimerB3Ctrl = TimerB3Ctrl_;
TimerB4Ctrl = TimerB4Ctrl_;
TimerB5Ctrl = TimerB5Ctrl_;
+
+#ifdef THREADS
+ components PlatformInterruptC;
+ IrqVector.PlatformInterrupt -> PlatformInterruptC;
+#endif
}
* @author Henrik Makitaavola <henrik.makitaavola@gmail.com>
*/
+#include "m16c62p_printf.h"
+
module HplM16c62pTimerInterruptP
{
provides interface HplM16c62pTimerInterrupt as TimerA0;
provides interface HplM16c62pTimerInterrupt as TimerB3;
provides interface HplM16c62pTimerInterrupt as TimerB4;
provides interface HplM16c62pTimerInterrupt as TimerB5;
+#ifdef THREADS
+ uses interface PlatformInterrupt;
+#define POST_AMBLE() call PlatformInterrupt.postAmble()
+#else
+#define POST_AMBLE()
+#endif
}
implementation
{
M16C_INTERRUPT_HANDLER(M16C_TMRA0)
{
signal TimerA0.fired();
+ POST_AMBLE();
}
default async event void TimerA1.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRA1)
{
signal TimerA1.fired();
+ POST_AMBLE();
}
default async event void TimerA2.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRA2)
{
signal TimerA2.fired();
+ POST_AMBLE();
}
default async event void TimerA3.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRA3)
{
signal TimerA3.fired();
+ POST_AMBLE();
}
default async event void TimerA4.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRA4)
{
signal TimerA4.fired();
+ POST_AMBLE();
}
default async event void TimerB0.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRB0)
{
signal TimerB0.fired();
+ POST_AMBLE();
}
default async event void TimerB1.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRB1)
{
signal TimerB1.fired();
+ POST_AMBLE();
}
default async event void TimerB2.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRB2)
{
signal TimerB2.fired();
+ POST_AMBLE();
}
default async event void TimerB3.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRB3)
{
signal TimerB3.fired();
+ POST_AMBLE();
}
default async event void TimerB4.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRB4)
{
signal TimerB4.fired();
+ POST_AMBLE();
}
default async event void TimerB5.fired() { }
M16C_INTERRUPT_HANDLER(M16C_TMRB5)
{
signal TimerB5.fired();
+ POST_AMBLE();
}
}
HplUart2P.Irq -> Irqs.Uart2;
HplUart2P.StopModeControl -> Uart2StopModeControl;
+
+#ifdef THREADS
+ components PlatformInterruptC;
+ Irqs.PlatformInterrupt -> PlatformInterruptC;
+#endif
}
provides interface HplM16c62pUartInterrupt as Uart0;
provides interface HplM16c62pUartInterrupt as Uart1;
provides interface HplM16c62pUartInterrupt as Uart2;
+
+#ifdef THREADS
+ uses interface PlatformInterrupt;
+#define POST_AMBLE() call PlatformInterrupt.postAmble()
+#else
+#define POST_AMBLE()
+#endif
}
implementation
{
M16C_INTERRUPT_HANDLER(M16C_UART0_NACK)
{
signal Uart0.tx();
+ POST_AMBLE();
}
default async event void Uart0.rx() { }
M16C_INTERRUPT_HANDLER(M16C_UART0_ACK)
{
signal Uart0.rx();
+ POST_AMBLE();
}
M16C_INTERRUPT_HANDLER(M16C_UART1_NACK)
{
signal Uart1.tx();
+ POST_AMBLE();
}
default async event void Uart1.rx() { }
M16C_INTERRUPT_HANDLER(M16C_UART1_ACK)
{
signal Uart1.rx();
+ POST_AMBLE();
}
M16C_INTERRUPT_HANDLER(M16C_UART2_NACK)
{
signal Uart2.tx();
+ POST_AMBLE();
}
default async event void Uart2.rx() { }
M16C_INTERRUPT_HANDLER(M16C_UART2_ACK)
{
signal Uart2.rx();
+ POST_AMBLE();
}
}
#ifdef _H_atmega128hardware_H
int uart_putchar(char c, FILE *stream) __attribute__((noinline)) @C() @spontaneous() {
#endif
+#ifdef __M16C62PHARDWARE_H__
+ int lowlevel_putc(int c) __attribute__((noinline)) @C() @spontaneous() {
+#endif
uint16_t q_size;
error_t q_error;
push( @includes, qw(
+ %T/platforms/mulle/fix
%T/platforms/mulle
%T/platforms/mulle/chips/rf230
%T/chips/rf2xx/rf230
HplAt45dbP.FlashSpi -> Spi;
HplAt45dbP.BusyWait -> BusyWaitMicroC;
- RealMainP.PlatformInit -> HplAt45dbP.Init;
+ RealMainP.SoftwareInit -> HplAt45dbP.Init;
}
*
* @author Henrik Makitaavola <henrik.makitaavola@gmail.com>
*/
+
+#include "m16c62p_printf.h"
module HplAt45dbP
{
provides
// TODO(Henrik) Move init code to a SplitControl interface and
// change the busy wait into a TimerMilli.startOneShot.
command error_t Init.init() {
+ printf("Ad45db init\n");
+ call WP.makeOutput();
+ call WP.set();
+ call RESET.makeOutput();
+ call RESET.set();
call Select.makeOutput();
call Select.set();
call VCC.makeOutput();