Merge branch 'develop' into sterly_refactor
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/c5901fcc Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/c5901fcc Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/c5901fcc Branch: refs/heads/develop Commit: c5901fcc12db4f4a689728a9a9ff74ff3d0f7d40 Parents: 0c0f3e1 12ef82c Author: Christopher Collins <ccoll...@apache.org> Authored: Wed Sep 21 15:06:50 2016 -0700 Committer: Christopher Collins <ccoll...@apache.org> Committed: Wed Sep 21 15:06:50 2016 -0700 ---------------------------------------------------------------------- .gitignore | 1 + apps/blecent/pkg.yml | 3 +- apps/blecent/src/main.c | 17 +- apps/blehci/src/main.c | 2 +- apps/bleprph/pkg.yml | 3 +- apps/bleprph/src/main.c | 8 +- apps/bletest/src/bletest_hci.c | 2 +- apps/bletest/src/main.c | 44 +- apps/bletiny/pkg.yml | 3 +- apps/bletiny/src/bletiny.h | 1 + apps/bletiny/src/cmd.c | 10 +- apps/bletiny/src/main.c | 22 +- apps/bletiny/src/parse.c | 16 + apps/bleuart/pkg.yml | 3 +- apps/bleuart/src/main.c | 19 +- apps/boot/pkg.yml | 1 - apps/boot/src/boot.c | 96 +- apps/ffs2native/src/main.c | 12 +- apps/ocf_sample/pkg.yml | 42 + apps/ocf_sample/src/main.c | 307 ++ apps/slinky/pkg.yml | 2 + apps/slinky/src/main.c | 65 +- apps/splitty/README.md | 34 + apps/splitty/pkg.yml | 49 + apps/splitty/src/main.c | 375 ++ compiler/gdbmacros/nffs.gdb | 116 + compiler/sim/compiler.yml | 1 - fs/nffs/src/nffs.c | 55 +- fs/nffs/src/nffs_block.c | 2 + fs/nffs/src/nffs_crc.c | 1 + fs/nffs/src/nffs_flash.c | 3 + fs/nffs/src/nffs_format.c | 1 + fs/nffs/src/nffs_gc.c | 2 + fs/nffs/src/nffs_hash.c | 4 +- fs/nffs/src/nffs_inode.c | 12 +- fs/nffs/src/nffs_misc.c | 1 + fs/nffs/src/nffs_priv.h | 34 +- fs/nffs/src/nffs_restore.c | 8 +- hw/bsp/arduino_primo_nrf52/pkg.yml | 1 + hw/bsp/arduino_primo_nrf52/split-primo.ld | 208 + .../src/arch/cortex_m4/gcc_startup_nrf52.s | 10 + .../arch/cortex_m4/gcc_startup_nrf52_split.s | 152 + hw/bsp/arduino_primo_nrf52/src/os_bsp.c | 12 +- hw/bsp/arduino_primo_nrf52/src/sbrk.c | 22 +- hw/bsp/bmd300eval/pkg.yml | 1 + hw/bsp/bmd300eval/split-bmd300eval.ld | 208 + .../src/arch/cortex_m4/gcc_startup_nrf52.s | 11 + .../arch/cortex_m4/gcc_startup_nrf52_split.s | 152 + hw/bsp/bmd300eval/src/os_bsp.c | 12 +- hw/bsp/bmd300eval/src/sbrk.c | 22 +- hw/bsp/native/src/sbrk.c | 3 +- hw/bsp/nrf51-arduino_101/src/sbrk.c | 4 - hw/bsp/nrf51-blenano/pkg.yml | 1 + hw/bsp/nrf51-blenano/split-nrf51dk.ld | 185 + .../src/arch/cortex_m0/gcc_startup_nrf51.s | 8 + .../arch/cortex_m0/gcc_startup_nrf51_split.s | 168 + hw/bsp/nrf51-blenano/src/os_bsp.c | 10 +- hw/bsp/nrf51-blenano/src/sbrk.c | 22 +- hw/bsp/nrf51dk-16kbram/pkg.yml | 1 + hw/bsp/nrf51dk-16kbram/split-nrf51dk-16kbram.ld | 185 + .../src/arch/cortex_m0/gcc_startup_nrf51.s | 26 +- .../arch/cortex_m0/gcc_startup_nrf51_split.s | 168 + hw/bsp/nrf51dk-16kbram/src/os_bsp.c | 8 +- hw/bsp/nrf51dk-16kbram/src/sbrk.c | 23 +- hw/bsp/nrf51dk/pkg.yml | 1 + hw/bsp/nrf51dk/split-nrf51dk.ld | 185 + .../src/arch/cortex_m0/gcc_startup_nrf51.s | 8 + .../arch/cortex_m0/gcc_startup_nrf51_split.s | 168 + hw/bsp/nrf51dk/src/os_bsp.c | 8 +- hw/bsp/nrf51dk/src/sbrk.c | 23 +- hw/bsp/nrf52dk/pkg.yml | 1 + hw/bsp/nrf52dk/split-nrf52dk.ld | 208 + .../src/arch/cortex_m4/gcc_startup_nrf52.s | 10 + .../arch/cortex_m4/gcc_startup_nrf52_split.s | 152 + hw/bsp/nrf52dk/src/os_bsp.c | 12 +- hw/bsp/nrf52dk/src/sbrk.c | 22 +- hw/bsp/nrf52pdk/src/sbrk.c | 3 - hw/bsp/nucleo-f401re/boot-nucleo-f401re.ld | 192 + hw/bsp/nucleo-f401re/include/bsp/bsp.h | 53 + hw/bsp/nucleo-f401re/include/bsp/bsp_sysid.h | 36 + hw/bsp/nucleo-f401re/include/bsp/cmsis_nvic.h | 29 + .../include/bsp/stm32f4xx_hal_conf.h | 413 ++ hw/bsp/nucleo-f401re/nucleo-f401re.ld | 208 + hw/bsp/nucleo-f401re/nucleo-f401re_debug.sh | 53 + hw/bsp/nucleo-f401re/nucleo-f401re_download.sh | 53 + hw/bsp/nucleo-f401re/pkg.yml | 39 + .../src/arch/cortex_m4/startup_STM32F40x.s | 343 ++ hw/bsp/nucleo-f401re/src/hal_bsp.c | 73 + hw/bsp/nucleo-f401re/src/libc_stubs.c | 84 + hw/bsp/nucleo-f401re/src/os_bsp.c | 82 + hw/bsp/nucleo-f401re/src/sbrk.c | 50 + hw/bsp/nucleo-f401re/src/system_stm32f4xx.c | 351 ++ .../stm32f4discovery/boot-stm32f4discovery.ld | 202 + hw/bsp/stm32f4discovery/f407.cfg | 82 + hw/bsp/stm32f4discovery/include/bsp/bsp.h | 55 + hw/bsp/stm32f4discovery/include/bsp/bsp_sysid.h | 36 + .../stm32f4discovery/include/bsp/cmsis_nvic.h | 29 + .../include/bsp/stm32f4xx_hal_conf.h | 413 ++ hw/bsp/stm32f4discovery/pkg.yml | 39 + hw/bsp/stm32f4discovery/run_from_flash.ld | 204 + hw/bsp/stm32f4discovery/run_from_loader.ld | 210 + hw/bsp/stm32f4discovery/run_from_sram.ld | 202 + .../src/arch/cortex_m4/startup_STM32F40x.s | 343 ++ hw/bsp/stm32f4discovery/src/hal_bsp.c | 77 + hw/bsp/stm32f4discovery/src/libc_stubs.c | 84 + hw/bsp/stm32f4discovery/src/os_bsp.c | 82 + hw/bsp/stm32f4discovery/src/sbrk.c | 50 + hw/bsp/stm32f4discovery/src/system_stm32f4xx.c | 351 ++ hw/bsp/stm32f4discovery/stm32f4discovery.ld | 213 + .../stm32f4discovery/stm32f4discovery_debug.sh | 57 + .../stm32f4discovery_download.sh | 54 + hw/hal/include/hal/hal_cputime.h | 16 + hw/hal/include/hal/hal_watchdog.h | 55 + hw/mcu/native/include/mcu/mcu_sim.h | 2 +- hw/mcu/native/src/hal_uart.c | 4 +- hw/mcu/stm/stm32f4xx/include/mcu/stm32f401xe.h | 4805 ++++++++++++++++++ hw/mcu/stm/stm32f4xx/src/hal_gpio.c | 2 +- hw/mcu/stm/stm32f4xx/src/hal_uart.c | 18 +- libs/baselibc/include/inttypes.h | 7 +- libs/baselibc/src/baselibc_test/unittests.h | 24 +- libs/boot_serial/src/boot_serial.c | 2 +- libs/bootutil/include/bootutil/bootutil_misc.h | 11 +- libs/bootutil/include/bootutil/image.h | 21 +- libs/bootutil/include/bootutil/loader.h | 17 +- libs/bootutil/pkg.yml | 2 + libs/bootutil/signed_images.md | 18 +- libs/bootutil/src/bootutil_misc.c | 381 +- libs/bootutil/src/bootutil_priv.h | 53 +- libs/bootutil/src/image_validate.c | 16 +- libs/bootutil/src/loader.c | 521 +- libs/bootutil/test/src/boot_test.c | 215 +- libs/console/full/include/console/prompt.h | 31 + libs/console/full/src/cons_tty.c | 5 + libs/console/full/src/prompt.c | 40 + .../stub/include/console/console_prompt.h | 35 + libs/imgmgr/include/imgmgr/imgmgr.h | 2 +- libs/imgmgr/pkg.yml | 7 +- libs/imgmgr/src/imgmgr.c | 95 +- libs/imgmgr/src/imgmgr_boot.c | 123 +- libs/imgmgr/src/imgmgr_cli.c | 139 + libs/imgmgr/src/imgmgr_priv.h | 7 +- libs/iotivity/include/iotivity/oc_api.h | 165 + libs/iotivity/include/iotivity/oc_buffer.h | 32 + .../iotivity/include/iotivity/oc_client_state.h | 88 + libs/iotivity/include/iotivity/oc_constants.h | 43 + libs/iotivity/include/iotivity/oc_core_res.h | 52 + libs/iotivity/include/iotivity/oc_discovery.h | 22 + libs/iotivity/include/iotivity/oc_helpers.h | 78 + .../include/iotivity/oc_network_events.h | 29 + libs/iotivity/include/iotivity/oc_rep.h | 228 + libs/iotivity/include/iotivity/oc_ri.h | 176 + libs/iotivity/include/iotivity/oc_uuid.h | 31 + libs/iotivity/pkg.yml | 41 + libs/iotivity/src/api/oc_buffer.c | 138 + libs/iotivity/src/api/oc_client_api.c | 287 ++ libs/iotivity/src/api/oc_core_res.c | 280 + libs/iotivity/src/api/oc_discovery.c | 298 ++ libs/iotivity/src/api/oc_events.h | 34 + libs/iotivity/src/api/oc_helpers.c | 164 + libs/iotivity/src/api/oc_main.c | 119 + libs/iotivity/src/api/oc_network_events.c | 57 + libs/iotivity/src/api/oc_rep.c | 301 ++ libs/iotivity/src/api/oc_ri.c | 1016 ++++ libs/iotivity/src/api/oc_server_api.c | 291 ++ libs/iotivity/src/api/oc_uuid.c | 119 + libs/iotivity/src/messaging/coap/coap.c | 1186 +++++ libs/iotivity/src/messaging/coap/coap.h | 297 ++ libs/iotivity/src/messaging/coap/conf.h | 71 + libs/iotivity/src/messaging/coap/constants.h | 158 + libs/iotivity/src/messaging/coap/engine.c | 333 ++ libs/iotivity/src/messaging/coap/engine.h | 48 + libs/iotivity/src/messaging/coap/observe.c | 319 ++ libs/iotivity/src/messaging/coap/observe.h | 80 + libs/iotivity/src/messaging/coap/oc_coap.h | 39 + libs/iotivity/src/messaging/coap/separate.c | 152 + libs/iotivity/src/messaging/coap/separate.h | 71 + libs/iotivity/src/messaging/coap/transactions.c | 202 + libs/iotivity/src/messaging/coap/transactions.h | 75 + libs/iotivity/src/port/mynewt/abort.c | 25 + libs/iotivity/src/port/mynewt/adaptor.c | 223 + libs/iotivity/src/port/mynewt/adaptor.h | 61 + libs/iotivity/src/port/mynewt/ble_adaptor.c | 18 + libs/iotivity/src/port/mynewt/clock.c | 41 + libs/iotivity/src/port/mynewt/config.h | 59 + libs/iotivity/src/port/mynewt/ip_adaptor.c | 315 ++ libs/iotivity/src/port/mynewt/log.c | 43 + libs/iotivity/src/port/mynewt/oc_loop.c | 26 + libs/iotivity/src/port/mynewt/random.c | 31 + libs/iotivity/src/port/mynewt/serial_adaptor.c | 153 + libs/iotivity/src/port/mynewt/storage.c | 38 + libs/iotivity/src/port/oc_assert.h | 42 + libs/iotivity/src/port/oc_clock.h | 102 + libs/iotivity/src/port/oc_connectivity.h | 84 + libs/iotivity/src/port/oc_log.h | 74 + .../iotivity/src/port/oc_network_events_mutex.h | 26 + libs/iotivity/src/port/oc_random.h | 56 + libs/iotivity/src/port/oc_signal_main_loop.h | 22 + libs/iotivity/src/port/oc_storage.h | 27 + libs/iotivity/src/security/oc_acl.c | 412 ++ libs/iotivity/src/security/oc_acl.h | 63 + libs/iotivity/src/security/oc_cred.c | 200 + libs/iotivity/src/security/oc_cred.h | 40 + libs/iotivity/src/security/oc_doxm.c | 128 + libs/iotivity/src/security/oc_doxm.h | 45 + libs/iotivity/src/security/oc_dtls.c | 372 ++ libs/iotivity/src/security/oc_dtls.h | 50 + libs/iotivity/src/security/oc_pstat.c | 119 + libs/iotivity/src/security/oc_pstat.h | 39 + libs/iotivity/src/security/oc_store.c | 158 + libs/iotivity/src/security/oc_store.h | 26 + libs/iotivity/src/security/oc_svr.c | 51 + libs/iotivity/src/security/oc_svr.h | 22 + libs/iotivity/src/util/oc_etimer.c | 263 + libs/iotivity/src/util/oc_etimer.h | 247 + libs/iotivity/src/util/oc_list.c | 317 ++ libs/iotivity/src/util/oc_list.h | 144 + libs/iotivity/src/util/oc_memb.c | 111 + libs/iotivity/src/util/oc_memb.h | 127 + libs/iotivity/src/util/oc_mmem.c | 154 + libs/iotivity/src/util/oc_mmem.h | 53 + libs/iotivity/src/util/oc_process.c | 346 ++ libs/iotivity/src/util/oc_process.h | 527 ++ libs/iotivity/src/util/oc_timer.c | 131 + libs/iotivity/src/util/oc_timer.h | 88 + libs/iotivity/src/util/pt/lc-addrlabels.h | 86 + libs/iotivity/src/util/pt/lc-switch.h | 79 + libs/iotivity/src/util/pt/lc.h | 130 + libs/iotivity/src/util/pt/pt-sem.h | 233 + libs/iotivity/src/util/pt/pt.h | 333 ++ libs/json/src/json_decode.c | 3 +- libs/json/test/src/test_json_simple.c | 6 +- libs/mbedtls/include/mbedtls/config_mynewt.h | 2 + libs/mbedtls/src/x509_crl.c | 5 +- libs/newtmgr/include/newtmgr/newtmgr.h | 14 +- libs/newtmgr/nmgr_os/include/nmgr_os/nmgr_os.h | 36 + libs/newtmgr/nmgr_os/pkg.yml | 35 + libs/newtmgr/nmgr_os/src/newtmgr_os.c | 326 ++ libs/newtmgr/pkg.yml | 4 + libs/newtmgr/src/newtmgr.c | 109 +- libs/newtmgr/src/newtmgr_os.c | 238 - libs/newtmgr/src/newtmgr_priv.h | 31 - libs/newtmgr_oic/include/newtmgr/newtmgr.h | 112 + libs/newtmgr_oic/pkg.yml | 44 + libs/newtmgr_oic/src/newtmgr.c | 500 ++ libs/os/include/os/os_eventq.h | 2 +- libs/os/include/os/os_time.h | 5 +- libs/os/src/test/callout_test.c | 330 ++ libs/os/test/src/eventq_test.c | 4 +- libs/os/test/src/mutex_test.c | 36 +- libs/os/test/src/os_test.c | 2 +- libs/os/test/src/os_test_priv.h | 2 +- libs/os/test/src/sem_test.c | 10 +- libs/shell/include/shell/shell.h | 3 + libs/shell/include/shell/shell_prompt.h | 25 + libs/shell/src/shell.c | 22 +- libs/shell/src/shell_prompt.c | 69 + libs/split/README.md | 63 + libs/split/include/split/split.h | 59 + libs/split/include/split/split_priv.h | 39 + libs/split/pkg.yml | 30 + libs/split/src/split.c | 74 + libs/split/src/split_config.c | 90 + libs/split/src/split_netmgr.c | 150 + libs/tinycbor/include/tinycbor/assert_p.h | 29 + libs/tinycbor/include/tinycbor/cbor.h | 479 ++ .../tinycbor/include/tinycbor/cborconstants_p.h | 52 + libs/tinycbor/include/tinycbor/cborjson.h | 62 + .../include/tinycbor/compilersupport_p.h | 218 + .../include/tinycbor/extract_number_p.h | 78 + libs/tinycbor/include/tinycbor/math_support_p.h | 47 + libs/tinycbor/pkg.yml | 26 + libs/tinycbor/src/cborencoder.c | 629 +++ .../src/cborencoder_close_container_checked.c | 82 + libs/tinycbor/src/cborerrorstrings.c | 165 + libs/tinycbor/src/cborparser.c | 1293 +++++ libs/tinycbor/src/cborparser_dup_string.c | 113 + libs/tinycbor/src/cborpretty.c | 470 ++ libs/tinycbor/src/cbortojson.c | 686 +++ libs/tinycbor/src/open_memstream.c | 117 + libs/tinycrypt/include/tinycrypt/constants.h | 4 - libs/util/include/util/hex.h | 25 + libs/util/src/hex.c | 101 + libs/util/src/test/hex_test.c | 125 + libs/util/test/src/util_test.c | 9 +- libs/util/test/src/util_test_priv.h | 1 + libs/wifi_mgmt/src/wifi_cli.c | 9 +- .../controller/include/controller/ble_ll.h | 35 +- .../controller/include/controller/ble_ll_adv.h | 3 + .../controller/include/controller/ble_ll_ctrl.h | 3 + .../controller/include/controller/ble_ll_hci.h | 3 + .../include/controller/ble_ll_resolv.h | 7 +- .../controller/include/controller/ble_ll_scan.h | 2 +- .../controller/include/controller/ble_phy.h | 3 + net/nimble/controller/src/ble_ll.c | 190 +- net/nimble/controller/src/ble_ll_adv.c | 72 +- net/nimble/controller/src/ble_ll_conn.c | 194 +- net/nimble/controller/src/ble_ll_conn_hci.c | 200 +- net/nimble/controller/src/ble_ll_conn_priv.h | 10 +- net/nimble/controller/src/ble_ll_hci.c | 2 + net/nimble/controller/src/ble_ll_hci_ev.c | 44 + net/nimble/controller/src/ble_ll_resolv.c | 175 +- net/nimble/controller/src/ble_ll_rng.c | 60 - net/nimble/controller/src/ble_ll_scan.c | 24 +- net/nimble/controller/src/ble_ll_sched.c | 14 +- net/nimble/drivers/native/src/ble_phy.c | 161 +- net/nimble/drivers/nrf51/src/ble_phy.c | 209 +- net/nimble/drivers/nrf52/src/ble_phy.c | 205 +- net/nimble/host/include/host/ble_att.h | 1 + net/nimble/host/include/host/ble_gap.h | 22 + net/nimble/host/include/host/ble_hs_adv.h | 3 + net/nimble/host/include/host/ble_l2cap.h | 3 +- .../gap/include/services/gap/ble_svc_gap.h | 39 + net/nimble/host/services/gap/pkg.yml | 31 + net/nimble/host/services/gap/src/ble_svc_gap.c | 167 + .../gatt/include/services/gatt/ble_svc_gatt.h | 29 + net/nimble/host/services/gatt/pkg.yml | 34 + .../host/services/gatt/src/ble_svc_gatt.c | 90 + .../lls/include/services/lls/ble_svc_lls.h | 44 + net/nimble/host/services/lls/pkg.yml | 31 + net/nimble/host/services/lls/src/ble_svc_lls.c | 201 + .../include/services/mandatory/ble_svc_gap.h | 39 - .../include/services/mandatory/ble_svc_gatt.h | 10 - net/nimble/host/services/mandatory/pkg.yml | 35 - .../host/services/mandatory/src/ble_svc_gap.c | 167 - .../host/services/mandatory/src/ble_svc_gatt.c | 90 - net/nimble/host/src/ble_att.c | 49 +- net/nimble/host/src/ble_att_clt.c | 118 +- net/nimble/host/src/ble_att_cmd.c | 31 +- net/nimble/host/src/ble_att_cmd_priv.h | 4 +- net/nimble/host/src/ble_att_priv.h | 4 +- net/nimble/host/src/ble_att_svr.c | 195 +- net/nimble/host/src/ble_gap.c | 424 +- net/nimble/host/src/ble_gap_priv.h | 1 + net/nimble/host/src/ble_gattc.c | 10 +- net/nimble/host/src/ble_gatts.c | 2 +- net/nimble/host/src/ble_hs.c | 25 +- net/nimble/host/src/ble_hs_adv.c | 2 - net/nimble/host/src/ble_hs_conn.c | 11 + net/nimble/host/src/ble_hs_conn_priv.h | 2 +- net/nimble/host/src/ble_hs_misc.c | 6 +- net/nimble/host/src/ble_hs_priv.h | 6 +- net/nimble/host/src/ble_l2cap_sig.c | 79 +- net/nimble/host/src/ble_l2cap_sig_priv.h | 1 + net/nimble/host/src/ble_sm.c | 83 +- net/nimble/host/src/ble_sm_cmd.c | 9 +- net/nimble/host/src/ble_sm_lgcy.c | 7 +- net/nimble/host/src/ble_sm_priv.h | 8 +- net/nimble/host/src/ble_sm_sc.c | 59 +- net/nimble/host/src/test/ble_hs_hci_test.c | 99 + net/nimble/host/test/src/ble_att_clt_test.c | 31 + net/nimble/host/test/src/ble_att_svr_test.c | 100 +- net/nimble/host/test/src/ble_gap_test.c | 524 +- .../host/test/src/ble_gatts_notify_test.c | 99 +- net/nimble/host/test/src/ble_hs_test_util.c | 202 +- net/nimble/host/test/src/ble_hs_test_util.h | 22 +- net/nimble/host/test/src/ble_l2cap_test.c | 135 +- net/nimble/host/test/src/ble_sm_test_util.c | 12 +- net/nimble/include/nimble/ble.h | 4 + net/nimble/include/nimble/hci_common.h | 4 + net/nimble/transport/ram/src/ble_hci_ram.c | 21 +- .../uart/include/transport/uart/ble_hci_uart.h | 32 +- net/nimble/transport/uart/pkg.yml | 16 +- net/nimble/transport/uart/src/ble_hci_uart.c | 414 +- repository.yml | 29 + sys/config/include/config/config.h | 3 +- sys/config/src/config.c | 13 +- sys/config/src/config_nmgr.c | 18 +- sys/coredump/src/coredump.c | 2 +- sys/fcb/include/fcb/fcb.h | 10 + sys/log/include/log/log.h | 37 +- sys/log/src/log.c | 28 +- sys/log/src/log_cbmem.c | 33 +- sys/log/src/log_console.c | 26 +- sys/log/src/log_fcb.c | 50 +- sys/log/src/log_nmgr.c | 10 +- sys/log/test/src/log_test.c | 5 +- .../include/mn_socket/arch/sim/native_sock.h | 25 + sys/mn_socket/include/mn_socket/mn_socket.h | 76 +- sys/mn_socket/include/mn_socket/mn_socket_ops.h | 3 + sys/mn_socket/src/arch/sim/native_itf.c | 212 + sys/mn_socket/src/arch/sim/native_sock.c | 753 +++ sys/mn_socket/src/arch/sim/native_sock_priv.h | 32 + sys/mn_socket/src/mn_socket.c | 15 + sys/mn_socket/src/mn_socket_aconv.c | 45 +- sys/mn_socket/test/src/mn_sock_test.c | 812 +++ sys/reboot/include/reboot/log_reboot.h | 2 +- sys/reboot/src/log_reboot.c | 37 +- sys/stats/src/stats.c | 2 +- sys/stats/src/stats_nmgr.c | 20 +- 389 files changed, 40937 insertions(+), 3161 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/blecent/pkg.yml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/blecent/src/main.c ---------------------------------------------------------------------- diff --cc apps/blecent/src/main.c index 1f9a424,c0f43a4..c9ae8a4 --- a/apps/blecent/src/main.c +++ b/apps/blecent/src/main.c @@@ -38,10 -42,24 +41,9 @@@ /* Application-specified header. */ #include "blecent.h" -#define BSWAP16(x) ((uint16_t)(((x) << 8) | (((x) & 0xff00) >> 8))) - -/** Mbuf settings. */ -#define MBUF_NUM_MBUFS (12) -#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4) -#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD) -#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE) - -static os_membuf_t blecent_mbuf_mpool_data[MBUF_MEMPOOL_SIZE]; -struct os_mbuf_pool blecent_mbuf_pool; -struct os_mempool blecent_mbuf_mpool; - /** Log data. */ - static struct log_handler blecent_log_console_handler; struct log blecent_log; -/** Priority of the nimble host and controller tasks. */ -#define BLE_LL_TASK_PRI (OS_TASK_PRI_HIGHEST) - /** blecent task settings. */ #define BLECENT_TASK_PRIO 1 #define BLECENT_STACK_SIZE (OS_STACK_ALIGN(336)) http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/blehci/src/main.c ---------------------------------------------------------------------- diff --cc apps/blehci/src/main.c index 5c3f7f4,52aab99..1c75528 --- a/apps/blehci/src/main.c +++ b/apps/blehci/src/main.c @@@ -18,13 -18,35 +18,13 @@@ */ #include <assert.h> #include "os/os.h" -#include "hal/hal_cputime.h" -#include "hal/hal_uart.h" - -/* BLE */ -#include "nimble/ble.h" -#include "nimble/hci_common.h" -#include "controller/ble_ll.h" -#include "transport/uart/ble_hci_uart.h" - -/* Nimble task priorities */ -#define BLE_LL_TASK_PRI (OS_TASK_PRI_HIGHEST) - -/* Create a mbuf pool of BLE mbufs */ -#define MBUF_NUM_MBUFS (7) -#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4) -#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD) -#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE) /* Our global device address (public) */ -uint8_t g_dev_addr[BLE_DEV_ADDR_LEN] = { 0 }; +uint8_t g_dev_addr[6] = { 0 }; /* Our random address (in case we need it) */ - uint8_t g_random_addr[6] = { 0 }; + uint8_t g_random_addr[BLE_DEV_ADDR_LEN] = { 0 }; -os_membuf_t default_mbuf_mpool_data[MBUF_MEMPOOL_SIZE]; - -struct os_mbuf_pool default_mbuf_pool; -struct os_mempool default_mbuf_mpool; - int main(void) { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bleprph/pkg.yml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bleprph/src/main.c ---------------------------------------------------------------------- diff --cc apps/bleprph/src/main.c index 9af8006,a53cb29..6792b50 --- a/apps/bleprph/src/main.c +++ b/apps/bleprph/src/main.c @@@ -37,12 -58,22 +37,11 @@@ /* Application-specified header. */ #include "bleprph.h" -/** Mbuf settings. */ -#define MBUF_NUM_MBUFS (12) -#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4) -#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD) -#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE) - -static os_membuf_t bleprph_mbuf_mpool_data[MBUF_MEMPOOL_SIZE]; -struct os_mbuf_pool bleprph_mbuf_pool; -struct os_mempool bleprph_mbuf_mpool; +#include "nmgrble/newtmgr_ble.h" /** Log data. */ - static struct log_handler bleprph_log_console_handler; struct log bleprph_log; -/** Priority of the nimble host and controller tasks. */ -#define BLE_LL_TASK_PRI (OS_TASK_PRI_HIGHEST) - /** bleprph task settings. */ #define BLEPRPH_TASK_PRIO 1 #define BLEPRPH_STACK_SIZE (OS_STACK_ALIGN(336)) http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bletest/src/bletest_hci.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bletest/src/main.c ---------------------------------------------------------------------- diff --cc apps/bletest/src/main.c index 70b68dd,ffc0b92..88e19c9 --- a/apps/bletest/src/main.c +++ b/apps/bletest/src/main.c @@@ -699,12 -740,18 +711,18 @@@ bletest_execute_advertiser(void #if (BLETEST_CONCURRENT_CONN_TEST == 1) /* See if it is time to hand a data packet to the connection */ if ((int32_t)(os_time_get() - g_next_os_time) >= 0) { -#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1) +#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1) /* Do we need to send a LTK reply? */ - if (g_bletest_ltk_reply_handle) { - //bletest_send_ltk_req_neg_reply(g_bletest_ltk_reply_handle); - bletest_send_ltk_req_reply(g_bletest_ltk_reply_handle); - g_bletest_ltk_reply_handle = 0; + mask = 1; + reply_handle = 1; + while (g_bletest_ltk_reply_handle && mask) { + if (g_bletest_ltk_reply_handle & mask) { + bletest_send_ltk_req_reply(reply_handle); + //bletest_send_ltk_req_neg_reply(reply_handle); + g_bletest_ltk_reply_handle &= ~mask; + } + ++reply_handle; + mask <<= 1; } #endif if (g_bletest_current_conns) { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bletiny/pkg.yml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bletiny/src/bletiny.h ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bletiny/src/cmd.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bletiny/src/main.c ---------------------------------------------------------------------- diff --cc apps/bletiny/src/main.c index 76ec1c6,17b1ea0..c066511 --- a/apps/bletiny/src/main.c +++ b/apps/bletiny/src/main.c @@@ -91,10 -112,9 +91,9 @@@ struct os_eventq bletiny_evq struct os_task bletiny_task; bssnz_t os_stack_t bletiny_stack[BLETINY_STACK_SIZE]; - static struct log_handler bletiny_log_console_handler; struct log bletiny_log; -bssnz_t struct bletiny_conn bletiny_conns[NIMBLE_OPT(MAX_CONNECTIONS)]; +bssnz_t struct bletiny_conn bletiny_conns[MYNEWT_VAL(BLE_MAX_CONNECTIONS)]; int bletiny_num_conns; static void *bletiny_svc_mem; @@@ -1615,9 -1664,27 +1622,8 @@@ main(void "bletiny_dsc_pool"); assert(rc == 0); - /* Initialize the bletiny system. */ - log_console_handler_init(&bletiny_log_console_handler); - log_register("bletiny", &bletiny_log, &bletiny_log_console_handler); - /* Initialize msys mbufs. */ - rc = os_mempool_init(&default_mbuf_mpool, MBUF_NUM_MBUFS, - MBUF_MEMBLOCK_SIZE, default_mbuf_mpool_data, - "default_mbuf_data"); - assert(rc == 0); - - rc = os_mbuf_pool_init(&default_mbuf_pool, &default_mbuf_mpool, - MBUF_MEMBLOCK_SIZE, MBUF_NUM_MBUFS); - assert(rc == 0); - - rc = os_msys_register(&default_mbuf_pool); - assert(rc == 0); - - /* Create the shell task. */ - rc = shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE, - SHELL_MAX_INPUT_LEN); - assert(rc == 0); - + /* Initialize the logging system. */ - log_init(); + log_register("bletiny", &bletiny_log, &log_console_handler, NULL); /* Initialize eventq for the application task. */ os_eventq_init(&bletiny_evq); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bleuart/pkg.yml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/bleuart/src/main.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/boot/pkg.yml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/boot/src/boot.c ---------------------------------------------------------------------- diff --cc apps/boot/src/boot.c index 49d4083,fb2b6b8..fa0ba84 --- a/apps/boot/src/boot.c +++ b/apps/boot/src/boot.c @@@ -28,16 -28,7 +29,7 @@@ #include <hal/hal_flash.h> #include <config/config.h> #include <config/config_file.h> - #if MYNEWT_VAL(BOOT_NFFS) - #include <fs/fs.h> - #include <nffs/nffs.h> - #elif MYNEWT_VAL(BOOT_FCB) - #include <fcb/fcb.h> - #include <config/config_fcb.h> - #else - #error "Need NFFS or FCB for config storage" - #endif -#ifdef BOOT_SERIAL +#if MYNEWT_VAL(BOOT_SERIAL) #include <hal/hal_gpio.h> #include <boot_serial/boot_serial.h> #endif @@@ -45,8 -37,8 +38,6 @@@ #include "bootutil/loader.h" #include "bootutil/bootutil_misc.h" --/* we currently need extra nffs_area_descriptors for booting since the -- * boot code uses these to keep track of which block to write and copy.*/ #define BOOT_AREA_DESC_MAX (256) #define AREA_DESC_MAX (BOOT_AREA_DESC_MAX) @@@ -117,37 -62,25 +61,22 @@@ main(void .br_slot_areas = img_starts, }; - os_init(); + struct boot_rsp rsp; + int rc; - cnt = BOOT_AREA_DESC_MAX; - rc = flash_area_to_sectors(FLASH_AREA_IMAGE_0, &cnt, descs); - img_starts[0] = 0; - total = cnt; - -#ifdef BOOT_SERIAL ++#if MYNEWT_VAL(BOOT_SERIAL) + os_init(); + #else + bsp_init(); + #endif - cnt = BOOT_AREA_DESC_MAX - total; - assert(cnt >= 0); - rc = flash_area_to_sectors(FLASH_AREA_IMAGE_1, &cnt, &descs[total]); + rc = hal_flash_init(); assert(rc == 0); - img_starts[1] = total; - total += cnt; - cnt = BOOT_AREA_DESC_MAX - total; - assert(cnt >= 0); - rc = flash_area_to_sectors(FLASH_AREA_IMAGE_SCRATCH, &cnt, &descs[total]); + rc = boot_build_request(&req, AREA_DESC_MAX); assert(rc == 0); - req.br_scratch_area_idx = total; - total += cnt; - - req.br_num_image_areas = total; - - #if MYNEWT_VAL(BOOT_NFFS) - setup_for_nffs(); - #elif MYNEWT_VAL(BOOT_FCB) - setup_for_fcb(); - #endif - bootutil_cfg_register(); - - conf_init(); -#ifdef BOOT_SERIAL +#if MYNEWT_VAL(BOOT_SERIAL) /* * Configure a GPIO as input, and compare it against expected value. * If it matches, await for download commands from serial. @@@ -167,4 -102,4 +98,3 @@@ return 0; } -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/ffs2native/src/main.c ---------------------------------------------------------------------- diff --cc apps/ffs2native/src/main.c index 90bb3fb,6558f0d..50a8b27 --- a/apps/ffs2native/src/main.c +++ b/apps/ffs2native/src/main.c @@@ -666,9 -671,19 +671,8 @@@ main(int argc, char **argv } os_init(); - if (standalone == 0) { - rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, area_descs); - assert(rc == 0); - } - - rc = hal_flash_init(); - assert(rc == 0); - log_console_handler_init(&nffs_log_console_handler); - log_register("nffs-log", &nffs_log, &nffs_log_console_handler); - rc = nffs_init(); - assert(rc == 0); - - log_init(); + log_register("nffs-log", &nffs_log, &log_console_handler, NULL); file_scratch_idx = MAX_AREAS + 1; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/slinky/pkg.yml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/apps/slinky/src/main.c ---------------------------------------------------------------------- diff --cc apps/slinky/src/main.c index 257a43e,5d607cf..02a5d34 --- a/apps/slinky/src/main.c +++ b/apps/slinky/src/main.c @@@ -29,7 -27,10 +29,10 @@@ #include <config/config.h> #include <hal/flash_map.h> #include <hal/hal_system.h> - #if MYNEWT_PKG_FS_FS + #if defined SPLIT_LOADER || defined SPLIT_APPLICATION + #include <split/split.h> + #endif -#ifdef NFFS_PRESENT ++#if MYNEWT_PKG_FS_NFFS #include <fs/fs.h> #include <nffs/nffs.h> #include <config/config_file.h> @@@ -70,11 -70,17 +72,10 @@@ static volatile int g_task1_loops /* Task 2 */ #define TASK2_PRIO (9) #define TASK2_STACK_SIZE OS_STACK_ALIGN(128) - struct os_task task2; - os_stack_t stack2[TASK2_STACK_SIZE]; + static struct os_task task2; - struct log_handler log_cbmem_handler; - struct log my_log; -#define SHELL_TASK_PRIO (3) -#define SHELL_MAX_INPUT_LEN (256) -#define SHELL_TASK_STACK_SIZE (OS_STACK_ALIGN(384)) - -#define NEWTMGR_TASK_PRIO (4) -#define NEWTMGR_TASK_STACK_SIZE (OS_STACK_ALIGN(896)) - + static struct log my_log; + extern struct log nffs_log; /* defined in the OS module */ static volatile int g_task2_loops; @@@ -294,11 -373,32 +307,12 @@@ main(int argc, char **argv rc = conf_register(&test_conf_handler); assert(rc == 0); - log_init(); cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF); - log_cbmem_handler_init(&log_cbmem_handler, &cbmem); - log_register("log", &my_log, &log_cbmem_handler); + cbmem_init(&nffs_cbmem, nffs_cbmem_buf, MAX_CBMEM_BUF); + log_register("log", &my_log, &log_cbmem_handler, &cbmem); + log_register("nffs", &nffs_log, &log_cbmem_handler, &nffs_cbmem); - os_init(); - - rc = os_mempool_init(&default_mbuf_mpool, DEFAULT_MBUF_MPOOL_NBUFS, - DEFAULT_MBUF_MPOOL_BUF_LEN, default_mbuf_mpool_data, - "default_mbuf_data"); - assert(rc == 0); - - rc = os_mbuf_pool_init(&default_mbuf_pool, &default_mbuf_mpool, - DEFAULT_MBUF_MPOOL_BUF_LEN, DEFAULT_MBUF_MPOOL_NBUFS); - assert(rc == 0); - - rc = os_msys_register(&default_mbuf_pool); - assert(rc == 0); - - rc = hal_flash_init(); - assert(rc == 0); - -#ifdef NFFS_PRESENT - setup_for_nffs(); -#elif FCB_PRESENT +#if !MYNEWT_VAL(CONFIG_NFFS) setup_for_fcb(); #endif @@@ -310,6 -426,12 +324,10 @@@ flash_test_init(); - reboot_init_handler(LOG_STORE_FCB, 11); - + #if defined SPLIT_LOADER || defined SPLIT_APPLICATION + split_app_init(); + #endif + conf_load(); log_reboot(HARD_REBOOT); @@@ -323,4 -455,4 +351,3 @@@ return rc; } -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/fs/nffs/src/nffs.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/fs/nffs/src/nffs_misc.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/fs/nffs/src/nffs_priv.h ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/fs/nffs/src/nffs_restore.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/arduino_primo_nrf52/pkg.yml ---------------------------------------------------------------------- diff --cc hw/bsp/arduino_primo_nrf52/pkg.yml index a2210d4,ea6aa29..724468b --- a/hw/bsp/arduino_primo_nrf52/pkg.yml +++ b/hw/bsp/arduino_primo_nrf52/pkg.yml @@@ -30,14 -30,11 +30,15 @@@ pkg.keywords pkg.arch: cortex_m4 pkg.compiler: compiler/arm-none-eabi-m4 pkg.linkerscript: "primo.ld" -pkg.linkerscript.bootloader.OVERWRITE: "boot-primo.ld" +pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-primo.ld" + pkg.part2linkerscript: "split-primo.ld" pkg.downloadscript: primo_download.sh pkg.debugscript: primo_debug.sh -pkg.cflags: -DNRF52 +pkg.cflags: + # Nordic SDK files require these defines. + - '-DNRF52' + - '-DSPI_MASTER_0_ENABLE' + pkg.deps: - hw/mcu/nordic/nrf52xxx - libs/baselibc http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/arduino_primo_nrf52/src/os_bsp.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/bmd300eval/pkg.yml ---------------------------------------------------------------------- diff --cc hw/bsp/bmd300eval/pkg.yml index b363ce1,9b906ca..cd1af60 --- a/hw/bsp/bmd300eval/pkg.yml +++ b/hw/bsp/bmd300eval/pkg.yml @@@ -29,14 -29,11 +29,15 @@@ pkg.keywords pkg.arch: cortex_m4 pkg.compiler: compiler/arm-none-eabi-m4 pkg.linkerscript: "bmd300eval.ld" -pkg.linkerscript.bootloader.OVERWRITE: "boot-bmd300eval.ld" +pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-bmd300eval.ld" + pkg.part2linkerscript: "split-bmd300eval.ld" pkg.downloadscript: bmd300eval_download.sh pkg.debugscript: bmd300eval_debug.sh -pkg.cflags: -DNRF52 -DBSP_HAS_32768_XTAL +pkg.cflags: + # Nordic SDK files require these defines. + - '-DNRF52' + - '-DSPI_MASTER_0_ENABLE' + pkg.deps: - hw/mcu/nordic/nrf52xxx - libs/baselibc http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/bmd300eval/src/os_bsp.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/nrf51-blenano/pkg.yml ---------------------------------------------------------------------- diff --cc hw/bsp/nrf51-blenano/pkg.yml index 8eb7ba5,6b45854..494d265 --- a/hw/bsp/nrf51-blenano/pkg.yml +++ b/hw/bsp/nrf51-blenano/pkg.yml @@@ -30,13 -30,11 +30,14 @@@ pkg.keywords pkg.arch: cortex_m0 pkg.compiler: compiler/arm-none-eabi-m0 pkg.linkerscript: "nrf51dk.ld" -pkg.linkerscript.bootloader.OVERWRITE: "boot-nrf51dk.ld" +pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51dk.ld" + pkg.part2linkerscript: "split-nrf51dk.ld" pkg.downloadscript: nrf51dk_download.sh pkg.debugscript: nrf51dk_debug.sh -pkg.cflags: -DNRF51 +pkg.cflags: + # Nordic SDK files require these defines. + - '-DNRF51' + pkg.deps: - hw/mcu/nordic/nrf51xxx - libs/baselibc http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/nrf51-blenano/src/os_bsp.c ---------------------------------------------------------------------- diff --cc hw/bsp/nrf51-blenano/src/os_bsp.c index d64c265,1dd867b..b17be8f --- a/hw/bsp/nrf51-blenano/src/os_bsp.c +++ b/hw/bsp/nrf51-blenano/src/os_bsp.c @@@ -84,12 -70,8 +90,12 @@@ void bsp_slot_init_split_application(vo } void - os_bsp_init(void) + bsp_init(void) { + int rc; + + (void)rc; + /* * XXX this reference is here to keep this function in. */ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/nrf51dk-16kbram/pkg.yml ---------------------------------------------------------------------- diff --cc hw/bsp/nrf51dk-16kbram/pkg.yml index 07506db,a240551..6b65dfb --- a/hw/bsp/nrf51dk-16kbram/pkg.yml +++ b/hw/bsp/nrf51dk-16kbram/pkg.yml @@@ -29,13 -29,11 +29,14 @@@ pkg.keywords pkg.arch: cortex_m0 pkg.compiler: compiler/arm-none-eabi-m0 pkg.linkerscript: "nrf51dk-16kbram.ld" -pkg.linkerscript.bootloader.OVERWRITE: "boot-nrf51dk-16kbram.ld" +pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51dk-16kbram.ld" + pkg.part2linkerscript: "split-nrf51dk-16kbram.ld" pkg.downloadscript: nrf51dk-16kbram_download.sh pkg.debugscript: nrf51dk-16kbram_debug.sh -pkg.cflags: -DNRF51 +pkg.cflags: + # Nordic SDK files require these defines. + - '-DNRF52' + pkg.deps: - hw/mcu/nordic/nrf51xxx - libs/baselibc http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/nrf51dk-16kbram/src/os_bsp.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/nrf51dk/pkg.yml ---------------------------------------------------------------------- diff --cc hw/bsp/nrf51dk/pkg.yml index a6c12fa,56de75a..beee6fc --- a/hw/bsp/nrf51dk/pkg.yml +++ b/hw/bsp/nrf51dk/pkg.yml @@@ -29,13 -29,11 +29,14 @@@ pkg.keywords pkg.arch: cortex_m0 pkg.compiler: compiler/arm-none-eabi-m0 pkg.linkerscript: "nrf51dk.ld" -pkg.linkerscript.bootloader.OVERWRITE: "boot-nrf51dk.ld" +pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51dk.ld" + pkg.part2linkerscript: "split-nrf51dk.ld" pkg.downloadscript: nrf51dk_download.sh pkg.debugscript: nrf51dk_debug.sh -pkg.cflags: -DNRF51 -DBSP_HAS_32768_XTAL +pkg.cflags: + # Nordic SDK files require this define. + - '-DNRF51' + pkg.deps: - hw/mcu/nordic/nrf51xxx - libs/baselibc http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/nrf51dk/src/os_bsp.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/nrf52dk/pkg.yml ---------------------------------------------------------------------- diff --cc hw/bsp/nrf52dk/pkg.yml index 9c1ded3,b65d9e2..e80dea9 --- a/hw/bsp/nrf52dk/pkg.yml +++ b/hw/bsp/nrf52dk/pkg.yml @@@ -29,14 -29,11 +29,15 @@@ pkg.keywords pkg.arch: cortex_m4 pkg.compiler: compiler/arm-none-eabi-m4 pkg.linkerscript: "nrf52dk.ld" -pkg.linkerscript.bootloader.OVERWRITE: "boot-nrf52dk.ld" +pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf52dk.ld" + pkg.part2linkerscript: "split-nrf52dk.ld" pkg.downloadscript: nrf52dk_download.sh pkg.debugscript: nrf52dk_debug.sh -pkg.cflags: -DNRF52 -DBSP_HAS_32768_XTAL +pkg.cflags: + # Nordic SDK files require these defines. + - '-DNRF52' + - '-DSPI_MASTER_0_ENABLE' + pkg.deps: - hw/mcu/nordic/nrf52xxx - libs/baselibc http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/bsp/nrf52dk/src/os_bsp.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/mcu/stm/stm32f4xx/src/hal_gpio.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/hw/mcu/stm/stm32f4xx/src/hal_uart.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/libs/bootutil/pkg.yml ---------------------------------------------------------------------- diff --cc libs/bootutil/pkg.yml index f9d2f70,f708f52..4d78647 --- a/libs/bootutil/pkg.yml +++ b/libs/bootutil/pkg.yml @@@ -26,24 -26,11 +26,26 @@@ pkg.keywords - bootloader pkg.deps: - - libs/os - - libs/testutil - - libs/mbedtls - hw/hal + - libs/mbedtls + - libs/os - sys/config +pkg.deps.BOOTUTIL_NFFS: + - fs/nffs + +pkg.init_function: bootutil_pkg_init +pkg.init_stage: 5 + +pkg.syscfg_defs: + BOOTUTIL_NFFS: + description: 'TBD' + value: 'MYNEWT_PKG_FS_NFFS' + BOOTUTIL_SIGN_RSA: + description: 'TBD' + value: '0' + BOOTUTIL_SIGN_EC: + description: 'TBD' + value: '0' + pkg.cflags.IMAGE_KEYS_RSA: -DIMAGE_SIGNATURES_RSA + pkg.cflags.IMAGE_KEYS_EC: -DIMAGE_SIGNATURES_EC http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/libs/bootutil/src/bootutil_misc.c ---------------------------------------------------------------------- diff --cc libs/bootutil/src/bootutil_misc.c index 17052fe,55dc7ec..0f9a2ce --- a/libs/bootutil/src/bootutil_misc.c +++ b/libs/bootutil/src/bootutil_misc.c @@@ -19,90 -19,35 +19,35 @@@ #include <string.h> #include <inttypes.h> -#include <assert.h> -#include <hal/hal_flash.h> -#include <hal/flash_map.h> -#include <hal/hal_bsp.h> -#include <os/os.h> + +#include "syscfg/syscfg.h" +#include "hal/hal_flash.h" +#include "config/config.h" +#include "os/os.h" #include "bootutil/image.h" + #include "bootutil/loader.h" + #include "bootutil/bootutil_misc.h" #include "bootutil_priv.h" - #if MYNEWT_VAL(BOOTUTIL_NFFS) - #include "fs/fs.h" - #include "fs/fsutil.h" - #endif - - static int boot_conf_set(int argc, char **argv, char *val); - - static struct image_version boot_main; - static struct image_version boot_test; - #if !MYNEWT_VAL(BOOTUTIL_NFFS) - static struct boot_status boot_saved; - #endif - - static struct conf_handler boot_conf_handler = { - .ch_name = "boot", - .ch_get = NULL, - .ch_set = boot_conf_set, - .ch_commit = NULL, - .ch_export = NULL, - }; - + /* + * Read the image trailer from a given slot. + */ static int - boot_conf_set(int argc, char **argv, char *val) + boot_vect_read_img_trailer(int slot, struct boot_img_trailer *bit) { int rc; - int len; - - if (argc == 1) { - if (!strcmp(argv[0], "main")) { - len = sizeof(boot_main); - if (val) { - rc = conf_bytes_from_str(val, &boot_main, &len); - } else { - memset(&boot_main, 0, len); - rc = 0; - } - } else if (!strcmp(argv[0], "test")) { - len = sizeof(boot_test); - if (val) { - rc = conf_bytes_from_str(val, &boot_test, &len); - } else { - memset(&boot_test, 0, len); - rc = 0; - } - #if !MYNEWT_VAL(BOOTUTIL_NFFS) - } else if (!strcmp(argv[0], "status")) { - if (!val) { - boot_saved.state = 0; - rc = 0; - } else { - rc = conf_value_from_str(val, CONF_INT32, - &boot_saved.state, sizeof(boot_saved.state)); - } - } else if (!strcmp(argv[0], "len")) { - conf_value_from_str(val, CONF_INT32, &boot_saved.length, - sizeof(boot_saved.length)); - rc = 0; - #endif - } else { - rc = OS_ENOENT; - } - } else { - rc = OS_ENOENT; - } - return rc; - } + const struct flash_area *fap; + uint32_t off; - static int - boot_vect_read_one(struct image_version *dst, struct image_version *src) - { - if (src->iv_major == 0 && src->iv_minor == 0 && - src->iv_revision == 0 && src->iv_build_num == 0) { - return BOOT_EBADVECT; + rc = flash_area_open(slot, &fap); + if (rc) { + return rc; } - memcpy(dst, src, sizeof(*dst)); - return 0; + off = fap->fa_size - sizeof(struct boot_img_trailer); + rc = flash_area_read(fap, off, bit, sizeof(*bit)); + flash_area_close(fap); + + return rc; } /** http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/libs/bootutil/src/image_validate.c ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5901fcc/libs/bootutil/src/loader.c ---------------------------------------------------------------------- diff --cc libs/bootutil/src/loader.c index 6d08b9a,e2d4cfa..c8f419d --- a/libs/bootutil/src/loader.c +++ b/libs/bootutil/src/loader.c @@@ -422,86 -572,81 +572,87 @@@ boot_go(const struct boot_req *req, str } } - /* Cache the flash address of each image slot. */ - for (i = 0; i < BOOT_NUM_SLOTS; i++) { - boot_slot_addr(i, &image_addrs[i].bil_flash_id, - &image_addrs[i].bil_address); - } - - /* Attempt to read an image header from each slot. */ - boot_read_image_headers(boot_img_hdrs, image_addrs, BOOT_NUM_SLOTS); - - /* Build a boot status structure indicating the flash location of each - * image part. This structure will need to be used if an image copy - * operation is required. + /* + * Check if we should initiate copy, or revert back to earlier image. + * */ - boot_build_status(); - - /* Determine which image the user wants to run, and where it is located. */ slot = boot_select_image_slot(); if (slot == -1) { - /* Either there is no image vector, or none of the requested images are - * present. Just try booting from the first image slot. - */ - if (boot_img_hdrs[0].ih_magic != IMAGE_MAGIC_NONE) { - slot = 0; - } else if (boot_img_hdrs[1].ih_magic != IMAGE_MAGIC_NONE) { - slot = 1; - } else { - /* No images present. */ - return BOOT_EBADIMAGE; - } + return BOOT_EBADIMAGE; } - /* - * If the selected image fails integrity check, try the other one. - */ - if (boot_image_check(&boot_img_hdrs[slot], &image_addrs[slot])) { - slot ^= 1; - if (boot_image_check(&boot_img_hdrs[slot], &image_addrs[slot])) { - return BOOT_EBADIMAGE; - } - } - switch (slot) { - case 0: - rsp->br_hdr = &boot_img_hdrs[0]; - break; - - case 1: - /* The user wants to run the image in the secondary slot. The contents - * of this slot need to moved to the primary slot. - */ + if (slot) { + boot_state.idx = 0; + boot_state.state = 0; rc = boot_copy_image(); - if (rc != 0) { - /* We failed to put the images back together; there is really no - * solution here. - */ + if (rc) { return rc; } + } + + /* Always boot from the primary slot. */ + rsp->br_flash_id = boot_img[0].loc.bil_flash_id; + rsp->br_image_addr = boot_img[0].loc.bil_address; + rsp->br_hdr = &boot_img[slot].hdr; + + return 0; + } + + #define SPLIT_AREA_DESC_MAX (255) + + int + split_go(int loader_slot, int split_slot, void **entry) + { + int rc; + /** Areas representing the beginning of image slots. */ + uint8_t img_starts[2]; + struct flash_area *descs; + uint32_t entry_val; + struct boot_req req = { + .br_slot_areas = img_starts, + }; + + descs = calloc(SPLIT_AREA_DESC_MAX, sizeof(struct flash_area)); + if (descs == NULL) { + return SPLIT_GO_ERR; + } - rsp->br_hdr = &boot_img_hdrs[1]; - break; + req.br_area_descs = descs; - default: - assert(0); - break; + rc = boot_build_request(&req, SPLIT_AREA_DESC_MAX); + if (rc != 0) { + rc = SPLIT_GO_ERR; + goto split_app_go_end; } - /* Always boot from the primary slot. */ - rsp->br_flash_id = image_addrs[0].bil_flash_id; - rsp->br_image_addr = image_addrs[0].bil_address; + boot_req = &req; - /* After successful boot, there should not be a status file. */ - boot_clear_status(); + boot_image_info(); - /* If an image is being tested, it should only be booted into once. */ - boot_vect_write_test(NULL); + /* Don't check the bootable image flag because we could really + * call a bootable or non-bootable image. Just validate that + * the image check passes which is distinct from the normal check */ + rc = split_image_check(&boot_img[split_slot].hdr, + &boot_img[split_slot].loc, + &boot_img[loader_slot].hdr, + &boot_img[loader_slot].loc); + if (rc != 0) { + rc = SPLIT_GO_NON_MATCHING; + goto split_app_go_end; + } - return 0; + entry_val = (uint32_t) boot_img[split_slot].loc.bil_address + + (uint32_t) boot_img[split_slot].hdr.ih_hdr_size; + *entry = (void*) entry_val; + rc = SPLIT_GO_OK; + + split_app_go_end: + free(descs); + return rc; } + +void +bootutil_pkg_init(void) +{ + bootutil_cfg_register(); +}