[ https://issues.apache.org/jira/browse/MYNEWT-708?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christopher Collins updated MYNEWT-708: --------------------------------------- Description: Now that main() runs after the OS is started, tasks may preempt the main task as soon as they are created. If such a task expects all packages to have been initialized, then a crash or other unpredictable behavior will occur. Here is an example crash that happens when the BLE link layer task runs before the host package is fully initialized: {noformat} Program received signal SIGTRAP, Trace/breakpoint trap. __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized out>, e=<optimized out>) at kernel/os/src/arch/cortex_m4/os_fault.c:137 137 asm("bkpt"); (gdb) whe #0 __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized out>, e=<optimized out>) at kernel/os/src/arch/cortex_m4/os_fault.c:137 #1 0x00019f2e in ble_hci_trans_ll_evt_tx (hci_ev=<optimized out>) at net/nimble/transport/ram/src/ble_hci_ram.c:91 #2 0x0000ea5e in ble_ll_hci_send_noop () at net/nimble/controller/src/ble_ll_hci.c:106 #3 0x0000a438 in ble_ll_task (arg=<optimized out>) at net/nimble/controller/src/ble_ll.c:1008 #4 0x00000000 in ?? () {noformat} was: Now that main() runs after the OS is started, tasks may preempt the main task as soon as they are created. If such a task expects all packages to have been initialized, then a crash or other unpredictable behavior will occur. Here is an example crash that happens when the BLE link layer task runs before the host package is fully initialized: {noformat} Program received signal SIGTRAP, Trace/breakpoint trap. __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized out>, e=<optimized out>) at kernel/os/src/arch/cortex_m4/os_fault.c:137 137 asm("bkpt"); (gdb) whe #0 __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized out>, e=<optimized out>) at kernel/os/src/arch/cortex_m4/os_fault.c:137 #1 0x00019f2e in ble_hci_trans_ll_evt_tx (hci_ev=<optimized out>) at net/nimble/transport/ram/src/ble_hci_ram.c:91 #2 0x0000ea5e in ble_ll_hci_send_noop () at net/nimble/controller/src/ble_ll_hci.c:106 #3 0x0000a438 in ble_ll_task (arg=<optimized out>) at net/nimble/controller/src/ble_ll.c:1008 #4 0x00000000 in ?? () (gdb) #0 __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized out>, e=<optimized out>) at kernel/os/src/arch/cortex_m4/os_fault.c:137 #1 0x00019f2e in ble_hci_trans_ll_evt_tx (hci_ev=<optimized out>) at net/nimble/transport/ram/src/ble_hci_ram.c:91 #2 0x0000ea5e in ble_ll_hci_send_noop () at net/nimble/controller/src/ble_ll_hci.c:106 #3 0x0000a438 in ble_ll_task (arg=<optimized out>) at net/nimble/controller/src/ble_ll.c:1008 #4 0x00000000 in ?? () {noformat} > Lock scheduler during init > -------------------------- > > Key: MYNEWT-708 > URL: https://issues.apache.org/jira/browse/MYNEWT-708 > Project: Mynewt > Issue Type: Bug > Reporter: Christopher Collins > Fix For: v1_1_0_rel > > > Now that main() runs after the OS is started, tasks may preempt the main task > as soon as they are created. If such a task expects all packages to have > been initialized, then a crash or other unpredictable behavior will occur. > Here is an example crash that happens when the BLE link layer task runs > before the host package is fully initialized: > {noformat} > Program received signal SIGTRAP, Trace/breakpoint trap. > __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized > out>, e=<optimized out>) at kernel/os/src/arch/cortex_m4/os_fault.c:137 > 137 asm("bkpt"); > (gdb) whe > #0 __assert_func (file=<optimized out>, line=<optimized out>, > func=<optimized out>, e=<optimized out>) at > kernel/os/src/arch/cortex_m4/os_fault.c:137 > #1 0x00019f2e in ble_hci_trans_ll_evt_tx (hci_ev=<optimized out>) at > net/nimble/transport/ram/src/ble_hci_ram.c:91 > #2 0x0000ea5e in ble_ll_hci_send_noop () at > net/nimble/controller/src/ble_ll_hci.c:106 > #3 0x0000a438 in ble_ll_task (arg=<optimized out>) at > net/nimble/controller/src/ble_ll.c:1008 > #4 0x00000000 in ?? () > {noformat} -- This message was sent by Atlassian JIRA (v6.3.15#6346)