f9micro / f9-kernel

An efficient and secure microkernel built for ARM Cortex-M cores, inspired by L4
Other
679 stars 145 forks source link

stm32p103 can't work in tickless mode #127

Open louisom opened 7 years ago

louisom commented 7 years ago

As a try to config for stm32p103 in tick schedule mode, QEMU-stm32 work will. But in tickless mode, it goes to "Reached end of schedule()"

xiangzhai commented 6 years ago

@louisom But still reproduce the issue when disable Tickless scheduling:

$ cat .config
#
# Automatically generated make config: don't edit
# F9 Microkernel Configurations
#

#
# Platform
#
# CONFIG_BOARD_STM32F4DISCOVERY is not set
# CONFIG_BOARD_STM32F429DISCOVERY is not set
CONFIG_BOARD_STM32P103=y
# CONFIG_BITMAP_BITBAND is not set
CONFIG_SEMIHOST=y
# CONFIG_STDIO_NODEV is not set
CONFIG_STDIO_USE_DBGPORT=y
# CONFIG_DBGPORT_USE_USART1 is not set
CONFIG_DBGPORT_USE_USART2=y
# CONFIG_DBGPORT_USE_USART4 is not set
# CONFIG_WWDG_USER_IRQ is not set
# CONFIG_PVD_USER_IRQ is not set
# CONFIG_TAMP_STAMP_USER_IRQ is not set
# CONFIG_RTC_WKUP_USER_IRQ is not set
# CONFIG_FLASH_USER_IRQ is not set
# CONFIG_RCC_USER_IRQ is not set
CONFIG_EXTI0_USER_IRQ=y
CONFIG_EXTI1_USER_IRQ=y
# CONFIG_EXTI2_USER_IRQ is not set
# CONFIG_EXTI3_USER_IRQ is not set
# CONFIG_EXTI4_USER_IRQ is not set
# CONFIG_ADC_USER_IRQ is not set
# CONFIG_CAN1_TX_USER_IRQ is not set
# CONFIG_CAN1_RX_USER_IRQ is not set
# CONFIG_CAN1_RX1_USER_IRQ is not set
# CONFIG_CAN1_SCE_USER_IRQ is not set
# CONFIG_EXTI9_5_USER_IRQ is not set
# CONFIG_TIM1_CC_USER_IRQ is not set
# CONFIG_TIM2_USER_IRQ is not set
# CONFIG_TIM3_USER_IRQ is not set
# CONFIG_TIM4_USER_IRQ is not set
# CONFIG_I2C1_EV_USER_IRQ is not set
# CONFIG_I2C1_ER_USER_IRQ is not set
# CONFIG_I2C2_EV_USER_IRQ is not set
# CONFIG_I2C2_ER_USER_IRQ is not set
# CONFIG_SPI1_USER_IRQ is not set
# CONFIG_SPI2_USER_IRQ is not set
# CONFIG_USART1_USER_IRQ is not set
# CONFIG_USART2_USER_IRQ is not set
# CONFIG_USART3_USER_IRQ is not set
# CONFIG_EXTI15_10_USER_IRQ is not set
# CONFIG_RTC_Alarm_USER_IRQ is not set
# CONFIG_OTG_FS_WKUP_USER_IRQ is not set

#
# User Interrupt Config
#
# CONFIG_DMA_Stream0_USER_IRQ is not set
# CONFIG_DMA_Stream1_USER_IRQ is not set
# CONFIG_DMA_Stream2_USER_IRQ is not set
# CONFIG_DMA_Stream3_USER_IRQ is not set
# CONFIG_DMA_Stream4_USER_IRQ is not set
# CONFIG_DMA_Stream5_USER_IRQ is not set
# CONFIG_DMA_Stream6_USER_IRQ is not set
# CONFIG_TIM1_BRK_USER_IRQ is not set
# CONFIG_TIM1_UP_USER_IRQ is not set
# CONFIG_TIM1_TRG_COM_USER_IRQ is not set

#
# Limitations
#
CONFIG_MAX_THREADS=32
CONFIG_MAX_KT_EVENTS=64
CONFIG_MAX_ASYNC_EVENTS=32
CONFIG_MAX_ADRESS_SPACES=16
CONFIG_MAX_FPAGES=256

#
# Kernel Timer
#
# CONFIG_KTIMER_TICKLESS is not set
CONFIG_KTIMER_HEARTBEAT=65536
CONFIG_KTIMER_MINTICKS=128

#
# Flexible page tweaks
#
CONFIG_LARGEST_FPAGE_SHIFT=16
CONFIG_SMALLEST_FPAGE_SHIFT=8

#
# Thread tweaks
#
CONFIG_INTR_THREAD_MAX=256

#
# KIP tweaks
#
CONFIG_KIP_EXTRA_SIZE=128

#
# Kernel hacking
#
CONFIG_DEBUG=y
CONFIG_DEBUG_DEV_UART=y
CONFIG_KDB=y
CONFIG_KPROBES=y
CONFIG_SYMMAP=y
CONFIG_PANIC_DUMP_STACK=y
# CONFIG_LOADER is not set

#
# Test Case
#
CONFIG_EXTI_INTERRUPT_TEST=y
$ make CROSS_COMPILE=/data/download/arm-2014.05/bin/arm-none-linux-gnueabi- QEMU_DIR=/data/project/qemu_stm32/arm-softmmu/ qemu
  CC      platform/stm32-common/gpio-f1.o
  CC      platform/stm32-common/rcc.o
  CC      platform/stm32-common/mpu.o
  CC      platform/stm32-common/nvic.o
  CC      platform/stm32-common/systick.o
  CC      platform/stm32-common/hwtimer.o
  CC      platform/stm32-common/usart.o
  CC      board/stm32p103/board.o
  CC      platform/bitops.o
  CC      platform/debug_device.o
  CC      platform/mpu.o
  CC      platform/spinlock.o
  CC      platform/irq.o
  CC      platform/debug_uart.o
  CC      platform/kprobes-arch.o
  CC      platform/breakpoint.o
  CC      platform/breakpoint-hard.o
  CC      platform/breakpoint-soft.o
  CC      platform/hw_debug.o
  CC      kernel/lib/queue.o
  CC      kernel/lib/ktable.o
  CC      kernel/lib/stdio.o
  CC      kernel/lib/bsearch.o
  CC      kernel/lib/sort.o
  CC      kernel/lib/memcpy.o
  CC      kernel/lib/memset.o
  CC      kernel/debug.o
  CC      kernel/error.o
  CC      kernel/fpage.o
  CC      kernel/init.o
  CC      kernel/ipc.o
  CC      kernel/kip.o
  CC      kernel/ktimer.o
  CC      kernel/memory.o
  CC      kernel/sched.o
  CC      kernel/softirq.o
  CC      kernel/start.o
  CC      kernel/syscall.o
  CC      kernel/systhread.o
  CC      kernel/thread.o
  CC      kernel/user-log.o
  CC      kernel/interrupt.o
  CC      kernel/kdb.o
  CC      kernel/kprobes.o
  CC      kernel/ksym.o
  CC      kernel/sampling.o
  CC      kernel/sampling-kdb.o
  CC      user/root_thread.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/include/l4/thread.h:12,
                 from user/root_thread.c:6:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  CC      user/lib/l4/platform/syscalls.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/lib/l4/platform/syscalls.c:11:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  CC      user/lib/l4/pager.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/include/l4/ipc.h:11,
                 from user/lib/l4/pager.c:7:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  CC      user/lib/io/l4io.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/include/l4/ipc.h:11,
                 from user/lib/io/l4io.c:7:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  CC      user/lib/io/user_interrupt.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/include/l4/thread.h:12,
                 from user/include/user_interrupt.h:5,
                 from user/lib/io/user_interrupt.c:5:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  CC      user/lib/io/semihost-io.o
  CC      user/lib/libposix/fork.o
  CC      user/lib/libposix/pthread.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/include/l4/ipc.h:11,
                 from user/lib/libposix/pthread.c:7:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  CC      user/apps/l4test/string.o
  CC      user/apps/l4test/ipc.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/include/l4/ipc.h:11,
                 from user/apps/l4test/ipc.c:7:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  CC      user/apps/l4test/assert.o
  CC      user/apps/l4test/main.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/include/l4/ipc.h:11,
                 from user/include/user_runtime.h:10,
                 from user/apps/l4test/main.c:7:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  CC      user/apps/pingpong/main.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/include/l4/ipc.h:11,
                 from user/include/user_runtime.h:10,
                 from user/apps/pingpong/main.c:7:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  CC      user/apps/irq_test/user_exti.o
  CC      user/apps/irq_test/main.o
In file included from user/include/l4/platform/syscalls.h:10:0,
                 from user/include/l4/ipc.h:11,
                 from user/include/user_runtime.h:10,
                 from user/apps/irq_test/main.c:7:
user/include/l4/platform/vregs.h: In function 'L4_StoreBRs':
user/include/l4/platform/vregs.h:247:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
user/include/l4/platform/vregs.h: In function 'L4_LoadBRs':
user/include/l4/platform/vregs.h:259:5: warning: assignment from incompatible pointer type [enabled by default]
  br = __L4_Utcb()->br + i;
     ^
  LD      f9_nosym.elf
  NM      f9.symmap.o
  LD      f9.elf
  OBJCOPY f9.elf.bin
  CAT     f9.bin
killall -q qemu-system-arm
mk/generic.mk:94: recipe for target 'qemu' failed
make: [qemu] Error 1 (ignored)
/data/project/qemu_stm32/arm-softmmu/qemu-system-arm -M stm32-p103 -kernel build/stm32p103/f9.bin -serial stdio -semihosting

(process:12134): GLib-WARNING **: gmem.c:483: custom memory allocation vtable not supported
VNC server running on `::1:5900'
LED Off
Reached end of schedule()
-------KTABLES------
-------KTIMER------

ktimer events: 
EVENT    DELTA       
-------NOW------
Now is 0
-------SOFTIRQ------
Kernel timer events              not scheduled
Asynchronous events              not scheduled
System calls                     not scheduled
KDB enters                       not scheduled
-------THREADS------
type  global   local    state  parent
-------MPU------
-------MEMPOOLS------
ID NAME                 SIZE       [START   :END     ] FLAGS     
 0 KTEXT                     21768 [08001000:08006508] r-x --- N 
 1 UTEXT                      9472 [2000f200:20011700] --- r-x M 
 2 KIP                         512 [20000400:20000600] rw- r-- S 
 3 KDATA                       928 [20000600:200009a0] rw- --- N 
 4 KBSS                      59304 [20000a00:2000f1a8] rw- --- N 
 5 UDATA                       768 [20011700:20011a00] --- rw- M 
 6 UBSS                        256 [20011a00:20011b00] --- rw- M 
 7 MEM0                      42184 [20011b38:2001c000] --- rw- S 
 8 KBITMAP                      56 [20011b00:20011b38] rw- --- N 
 9 APB1DEV                   30720 [40000000:40007800] --- rw- D 
10 APB2_1DEV                 19456 [40010000:40014c00] --- rw- D 
11 APB2_2DEV                  3072 [40014000:40014c00] --- rw- D 
12 AHB1_1DEV                 15360 [40020000:40023c00] --- rw- D 
13 AHB1_2DEV                115712 [40023c00:40040000] --- rw- D 
14 AHB2DEV                  397312 [50000000:50061000] --- rw- D 
15 AHB3DEV              1073745920 [60000000:a0001000] --- rw- D 
-------AS------
-------TOP------
Init sampling...

Stack dump:
20000330 00000000 200013d8 00000006 00000000 200013d0 00000000 cccccccd 
0800417f 08005ce4 000020ac 0000202c 00000000 40004400 0000000c 20000618 
00000020 200007d7 0800172f fffffff9 00000001 000020ac 0000202c 40004400 
00003000 0800192f 08001534 01000200 00000000 0000000d 080018d9 08005d7a 
00000000 08001665 0000000a 080021b9 00002000 200003e4 00000020 200003e8 
00000000 0000e7a8 00000000 00000000 00000000 00000000 00000000 00000000 
00000000 08002083 080016b1 200003e4 0000e7a8 080042e9 08005d78 200007d8 
00000000 20001384 e000ed24 080043dd 00000000 00000000 00000000