diff --git a/configs/z80sim/defconfig b/configs/z80sim/defconfig index 0603818d0bc..a993a6aeb1f 100644 --- a/configs/z80sim/defconfig +++ b/configs/z80sim/defconfig @@ -285,5 +285,5 @@ CONFIG_CUSTOM_STACK=n CONFIG_PROC_STACK_SIZE=1024 CONFIG_PTHREAD_STACK_MIN= CONFIG_PTHREAD_STACK_DEFAULT= -CONFIG_HEAP_SIZE=32768 -CONFIG_HEAP_BASE=CONFIG_DRAM_SIZE-CONFIG_HEAP_SIZE +CONFIG_HEAP_SIZE= +CONFIG_HEAP_BASE= diff --git a/configs/z80sim/src/z80_irq.c b/configs/z80sim/src/z80_irq.c index b6e81b32e1d..5fd15035984 100644 --- a/configs/z80sim/src/z80_irq.c +++ b/configs/z80sim/src/z80_irq.c @@ -76,10 +76,21 @@ void up_irqinitialize(void) current_regs = NULL; - /* And finally, enable interrupts */ + /* Attach the timer interrupt -- There is not special timer interrupt + * enable in the simulation so it must be enabled here before interrupts + * are enabled. + * + * NOTE: Normally, there are seperate enables for "global" interrupts + * and specific device interrupts. In such a "normal" case, the timer + * interrupt should be attached and enabled in the the function up_timerinit() + */ + + irq_attach(Z80_IRQ_SYSTIMER, (xcpt_t)up_timerisr); + + /* And finally, enable interrupts (including the timer) */ #ifndef CONFIG_SUPPRESS_INTERRUPTS - irqrestore(TRUE); + irqrestore(Z80_C_FLAG); #endif } @@ -93,7 +104,7 @@ void up_irqinitialize(void) void up_disable_irq(int irq) { - irqrestore(FALSE); + irqrestore(0); } /**************************************************************************** diff --git a/configs/z80sim/src/z80_timerisr.c b/configs/z80sim/src/z80_timerisr.c index e56678d13e0..a088d14b862 100644 --- a/configs/z80sim/src/z80_timerisr.c +++ b/configs/z80sim/src/z80_timerisr.c @@ -91,5 +91,6 @@ int up_timerisr(int irq, FAR chipreg_t *regs) void up_timerinit(void) { + /* The timer interrupt was attached in up_irqinitialize -- see comments there */ }