You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/09/13 03:41:56 UTC

[03/41] incubator-mynewt-core git commit: syscfg / sysinit

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/host/test/src/ble_sm_test_util.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_sm_test_util.h b/net/nimble/host/test/src/ble_sm_test_util.h
new file mode 100644
index 0000000..3323be6
--- /dev/null
+++ b/net/nimble/host/test/src/ble_sm_test_util.h
@@ -0,0 +1,119 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_SM_TEST_UTIL_
+#define H_BLE_SM_TEST_UTIL_
+
+struct ble_sm_test_passkey_info {
+    struct ble_sm_io passkey;
+    uint32_t exp_numcmp;
+    unsigned io_before_rx:1;
+};
+
+struct ble_sm_test_params {
+    uint8_t init_addr_type;
+    uint8_t init_id_addr[6];
+    uint8_t init_rpa[6];
+    uint8_t resp_addr_type;
+    uint8_t resp_id_addr[6];
+    uint8_t resp_rpa[6];
+    struct ble_sm_test_passkey_info passkey_info;
+
+    struct ble_sm_sec_req sec_req;
+    struct ble_sm_pair_cmd pair_req;
+    struct ble_sm_pair_cmd pair_rsp;
+    struct ble_sm_pair_confirm confirm_req[20];
+    struct ble_sm_pair_confirm confirm_rsp[20];
+    struct ble_sm_pair_random random_req[20];
+    struct ble_sm_pair_random random_rsp[20];
+    struct ble_sm_id_info id_info_req;
+    struct ble_sm_id_info id_info_rsp;
+    struct ble_sm_id_addr_info id_addr_info_req;
+    struct ble_sm_id_addr_info id_addr_info_rsp;
+    struct ble_sm_sign_info sign_info_req;
+    struct ble_sm_sign_info sign_info_rsp;
+    struct ble_sm_pair_fail pair_fail;
+
+    int pair_alg;
+    unsigned authenticated:1;
+
+    /*** Secure connections fields. */
+    uint8_t ltk[16];
+    uint8_t our_priv_key[32];
+    struct ble_sm_public_key public_key_req;
+    struct ble_sm_public_key public_key_rsp;
+    struct ble_sm_dhkey_check dhkey_check_req;
+    struct ble_sm_dhkey_check dhkey_check_rsp;
+
+    /*** Legacy fields. */
+    uint8_t stk[16];
+    struct ble_sm_enc_info enc_info_req;
+    struct ble_sm_enc_info enc_info_rsp;
+    struct ble_sm_master_id master_id_req;
+    struct ble_sm_master_id master_id_rsp;
+};
+
+extern int ble_sm_test_gap_event;
+extern int ble_sm_test_gap_status;
+extern struct ble_gap_sec_state ble_sm_test_sec_state;
+
+extern int ble_sm_test_store_obj_type;
+extern union ble_store_key ble_sm_test_store_key;
+extern union ble_store_value ble_sm_test_store_value;
+
+void ble_sm_test_util_init(void);
+int ble_sm_test_util_conn_cb(struct ble_gap_event *ctxt, void *arg);
+void ble_sm_test_util_io_inject(struct ble_sm_test_passkey_info *passkey_info,
+                                uint8_t cur_sm_state);
+void ble_sm_test_util_io_inject_bad(uint16_t conn_handle,
+                                    uint8_t correct_io_act);
+void ble_sm_test_util_io_check_pre(
+    struct ble_sm_test_passkey_info *passkey_info,
+    uint8_t cur_sm_state);
+void ble_sm_test_util_io_check_post(
+    struct ble_sm_test_passkey_info *passkey_info,
+    uint8_t cur_sm_state);
+void ble_sm_test_util_rx_sec_req(uint16_t conn_handle,
+                                 struct ble_sm_sec_req *cmd,
+                                 int exp_status);
+void ble_sm_test_util_verify_tx_pair_fail(struct ble_sm_pair_fail *exp_cmd);
+void ble_sm_test_util_us_lgcy_good(struct ble_sm_test_params *params);
+void ble_sm_test_util_peer_fail_inval(int we_are_master,
+                                      uint8_t *init_addr,
+                                      uint8_t *resp_addr,
+                                      struct ble_sm_pair_cmd *pair_req,
+                                      struct ble_sm_pair_fail *pair_fail);
+void ble_sm_test_util_peer_lgcy_fail_confirm(
+    uint8_t *init_addr,
+    uint8_t *resp_addr,
+    struct ble_sm_pair_cmd *pair_req,
+    struct ble_sm_pair_cmd *pair_rsp,
+    struct ble_sm_pair_confirm *confirm_req,
+    struct ble_sm_pair_confirm *confirm_rsp,
+    struct ble_sm_pair_random *random_req,
+    struct ble_sm_pair_random *random_rsp,
+    struct ble_sm_pair_fail *fail_rsp);
+
+void ble_sm_test_util_peer_lgcy_good(struct ble_sm_test_params *params);
+void ble_sm_test_util_peer_bonding_bad(uint16_t ediv, uint64_t rand_num);
+void ble_sm_test_util_peer_sc_good(struct ble_sm_test_params *params);
+void ble_sm_test_util_us_sc_good(struct ble_sm_test_params *params);
+void ble_sm_test_util_us_fail_inval(struct ble_sm_test_params *params);
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/host/test/src/ble_uuid_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_uuid_test.c b/net/nimble/host/test/src/ble_uuid_test.c
new file mode 100644
index 0000000..1011303
--- /dev/null
+++ b/net/nimble/host/test/src/ble_uuid_test.c
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stddef.h>
+#include <string.h>
+#include "testutil/testutil.h"
+#include "host/ble_hs_test.h"
+#include "host/ble_uuid.h"
+#include "ble_hs_test_util.h"
+
+TEST_CASE(ble_uuid_test_128_to_16)
+{
+    uint16_t uuid16;
+
+    /*** RFCOMM */
+    uuid16 = ble_uuid_128_to_16(((uint8_t[]) {
+        0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+        0x00, 0x10, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
+    }));
+    TEST_ASSERT(uuid16 == 0x0003);
+
+    /*** BNEP */
+    uuid16 = ble_uuid_128_to_16(((uint8_t[]) {
+        0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+        0x00, 0x10, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00
+    }));
+    TEST_ASSERT(uuid16 == 0x000f);
+
+    /*** L2CAP */
+    uuid16 = ble_uuid_128_to_16(((uint8_t[]) {
+        0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+        0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00
+    }));
+    TEST_ASSERT(uuid16 == 0x0100);
+
+    /*** ObEXObjectPush */
+    uuid16 = ble_uuid_128_to_16(((uint8_t[]) {
+        0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+        0x00, 0x10, 0x00, 0x00, 0x05, 0x11, 0x00, 0x00
+    }));
+    TEST_ASSERT(uuid16 == 0x1105);
+
+    /*** Invalid base. */
+    uuid16 = ble_uuid_128_to_16(((uint8_t[]) {
+        0xfb, 0x34, 0x9c, 0x5f, 0x80, 0x00, 0x00, 0x80,
+        0x00, 0x10, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
+    }));
+    TEST_ASSERT(uuid16 == 0);
+
+    /*** Invalid prefix. */
+    uuid16 = ble_uuid_128_to_16(((uint8_t[]) {
+        0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+        0x00, 0x10, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01
+    }));
+    TEST_ASSERT(uuid16 == 0);
+
+    /*** 16-bit UUID of 0. */
+    uuid16 = ble_uuid_128_to_16(((uint8_t[]) {
+        0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+        0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+    }));
+}
+
+TEST_SUITE(ble_uuid_test_suite)
+{
+    tu_suite_set_post_test_cb(ble_hs_test_util_post_test, NULL);
+
+    ble_uuid_test_128_to_16();
+}
+
+int
+ble_uuid_test_all(void)
+{
+    ble_uuid_test_suite();
+
+    return tu_any_failed;
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/include/nimble/nimble_opt.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/nimble_opt.h b/net/nimble/include/nimble/nimble_opt.h
index 319c08d..82d2d55 100644
--- a/net/nimble/include/nimble/nimble_opt.h
+++ b/net/nimble/include/nimble/nimble_opt.h
@@ -20,383 +20,6 @@
 #ifndef H_NIMBLE_OPT_
 #define H_NIMBLE_OPT_
 
-/** HOST / CONTROLLER: Maximum number of concurrent connections. */
-
-#ifndef NIMBLE_OPT_MAX_CONNECTIONS
-#define NIMBLE_OPT_MAX_CONNECTIONS              1
-#endif
-
-
-/**
- * HOST / CONTROLLER: Supported GAP roles.  By default, all four roles are
- * enabled.
- */
-
-#ifndef NIMBLE_OPT_ROLE_CENTRAL
-#define NIMBLE_OPT_ROLE_CENTRAL                 1
-#endif
-
-#ifndef NIMBLE_OPT_ROLE_PERIPHERAL
-#define NIMBLE_OPT_ROLE_PERIPHERAL              1
-#endif
-
-#ifndef NIMBLE_OPT_ROLE_BROADCASTER
-#define NIMBLE_OPT_ROLE_BROADCASTER             1
-#endif
-
-#ifndef NIMBLE_OPT_ROLE_OBSERVER
-#define NIMBLE_OPT_ROLE_OBSERVER                1
-#endif
-
-#ifndef NIMBLE_OPT_WHITELIST
-#define NIMBLE_OPT_WHITELIST                    1
-#endif
-
-/** HOST: Security manager legacy pairing.  Enabled by default. */
-
-#ifndef NIMBLE_OPT_SM
-#define NIMBLE_OPT_SM                           1
-#endif
-
-/** HOST: Security manage secure connections (4.2).  Disabled by default. */
-
-#ifndef NIMBLE_OPT_SM_SC
-#define NIMBLE_OPT_SM_SC                        0
-#endif
-
-/**
- * HOST: Supported GATT procedures.  By default:
- *     o Notify and indicate are enabled;
- *     o All other procedures are enabled for centrals.
- */
-
-#ifndef NIMBLE_OPT_GATT_DISC_ALL_SVCS
-#define NIMBLE_OPT_GATT_DISC_ALL_SVCS           NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_DISC_SVC_UUID
-#define NIMBLE_OPT_GATT_DISC_SVC_UUID           NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_FIND_INC_SVCS
-#define NIMBLE_OPT_GATT_FIND_INC_SVCS           NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_DISC_ALL_CHRS
-#define NIMBLE_OPT_GATT_DISC_ALL_CHRS           NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_DISC_CHR_UUID
-#define NIMBLE_OPT_GATT_DISC_CHR_UUID           NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_DISC_ALL_DSCS
-#define NIMBLE_OPT_GATT_DISC_ALL_DSCS           NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_READ
-#define NIMBLE_OPT_GATT_READ                    NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_READ_UUID
-#define NIMBLE_OPT_GATT_READ_UUID               NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_READ_LONG
-#define NIMBLE_OPT_GATT_READ_LONG               NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_READ_MULT
-#define NIMBLE_OPT_GATT_READ_MULT               NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_WRITE_NO_RSP
-#define NIMBLE_OPT_GATT_WRITE_NO_RSP            NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_SIGNED_WRITE
-#define NIMBLE_OPT_GATT_SIGNED_WRITE            NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_WRITE
-#define NIMBLE_OPT_GATT_WRITE                   NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_WRITE_LONG
-#define NIMBLE_OPT_GATT_WRITE_LONG              NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_WRITE_RELIABLE
-#define NIMBLE_OPT_GATT_WRITE_RELIABLE          NIMBLE_OPT_ROLE_CENTRAL
-#endif
-
-#ifndef NIMBLE_OPT_GATT_NOTIFY
-#define NIMBLE_OPT_GATT_NOTIFY                  1
-#endif
-
-#ifndef NIMBLE_OPT_GATT_INDICATE
-#define NIMBLE_OPT_GATT_INDICATE                1
-#endif
-
-/** HOST: GATT options. */
-
-/* The maximum number of attributes that can be written with a single GATT
- * Reliable Write procedure.
- */
-#ifndef NIMBLE_OPT_GATT_WRITE_MAX_ATTRS
-#define NIMBLE_OPT_GATT_WRITE_MAX_ATTRS         4
-#endif
-
-/** HOST: Supported server ATT commands. */
-
-#ifndef NIMBLE_OPT_ATT_SVR_FIND_INFO
-#define NIMBLE_OPT_ATT_SVR_FIND_INFO            1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_FIND_TYPE
-#define NIMBLE_OPT_ATT_SVR_FIND_TYPE            1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_READ_TYPE
-#define NIMBLE_OPT_ATT_SVR_READ_TYPE            1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_READ
-#define NIMBLE_OPT_ATT_SVR_READ                 1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_READ_BLOB
-#define NIMBLE_OPT_ATT_SVR_READ_BLOB            1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_READ_MULT
-#define NIMBLE_OPT_ATT_SVR_READ_MULT            1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_READ_GROUP_TYPE
-#define NIMBLE_OPT_ATT_SVR_READ_GROUP_TYPE      1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_WRITE
-#define NIMBLE_OPT_ATT_SVR_WRITE                1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_WRITE_NO_RSP
-#define NIMBLE_OPT_ATT_SVR_WRITE_NO_RSP         1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_SIGNED_WRITE
-#define NIMBLE_OPT_ATT_SVR_SIGNED_WRITE         1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_PREP_WRITE
-#define NIMBLE_OPT_ATT_SVR_PREP_WRITE           1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_EXEC_WRITE
-#define NIMBLE_OPT_ATT_SVR_EXEC_WRITE           1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_NOTIFY
-#define NIMBLE_OPT_ATT_SVR_NOTIFY               1
-#endif
-
-#ifndef NIMBLE_OPT_ATT_SVR_INDICATE
-#define NIMBLE_OPT_ATT_SVR_INDICATE             1
-#endif
-
-
-/** HOST: Miscellaneous features. */
-
-#ifndef NIMBLE_OPT_EDDYSTONE
-#define NIMBLE_OPT_EDDYSTONE                    1
-#endif
-
-
-/*** CONTROLLER ***/
-
-/*
- * Sleep clock accuracy (sca). This is the amount of drift in the system during
- * when the device is sleeping (in parts per million).
- *
- * NOTE: the master sca is an enumerated value based on the sca. Rather than
- * have a piece of code calculate this value, the developer must set this
- * value based on the value of the SCA using the following table:
- *
- *  SCA between 251 and 500 ppm (inclusive); master sca = 0
- *  SCA between 151 and 250 ppm (inclusive); master sca = 1
- *  SCA between 101 and 150 ppm (inclusive); master sca = 2
- *  SCA between 76 and 100 ppm (inclusive); master sca = 3
- *  SCA between 51 and 75 ppm (inclusive); master sca = 4
- *  SCA between 31 and 50 ppm (inclusive); master sca = 5
- *  SCA between 21 and 30 ppm (inclusive); master sca = 6
- *  SCA between 0 and 20 ppm (inclusive); master sca = 7
- *
- *  For example:
- *      if your clock drift is 101 ppm, your master should be set to 2.
- *      if your clock drift is 20, your master sca should be set to 7.
- *
- *  The values provided below are merely meant to be an example and should
- *  be replaced by values appropriate for your platform.
- */
-#ifndef NIMBLE_OPT_LL_OUR_SCA
-#define NIMBLE_OPT_LL_OUR_SCA                   (60)    /* in ppm */
-#endif
-
-#ifndef NIMBLE_OPT_LL_MASTER_SCA
-#define NIMBLE_OPT_LL_MASTER_SCA                (4)
-#endif
-
-/* transmit power level */
-#ifndef NIMBLE_OPT_LL_TX_PWR_DBM
-#define NIMBLE_OPT_LL_TX_PWR_DBM                (0)
-#endif
-
-/*
- * Determines the maximum rate at which the controller will send the
- * number of completed packets event to the host. Rate is in os time ticks
- */
-#ifndef NIMBLE_OPT_NUM_COMP_PKT_RATE
-#define NIMBLE_OPT_NUM_COMP_PKT_RATE    ((2000 * OS_TICKS_PER_SEC) / 1000)
-#endif
-
-/* Manufacturer ID. Should be set to unique ID per manufacturer */
-#ifndef NIMBLE_OPT_LL_MFRG_ID
-#define NIMBLE_OPT_LL_MFRG_ID                   (0xFFFF)
-#endif
-
-/*
- * Configuration items for the number of duplicate advertisers and the
- * number of advertisers from which we have heard a scan response.
- */
-#ifndef NIMBLE_OPT_LL_NUM_SCAN_DUP_ADVS
-#define NIMBLE_OPT_LL_NUM_SCAN_DUP_ADVS         (8)
-#endif
-
-#ifndef NIMBLE_OPT_LL_NUM_SCAN_RSP_ADVS
-#define NIMBLE_OPT_LL_NUM_SCAN_RSP_ADVS         (8)
-#endif
-
-/* Size of the LL whitelist */
-#ifndef NIMBLE_OPT_LL_WHITELIST_SIZE
-#define NIMBLE_OPT_LL_WHITELIST_SIZE            (8)
-#endif
-
-/* Size of the resolving ist */
-#ifndef NIMBLE_OPT_LL_RESOLV_LIST_SIZE
-#define NIMBLE_OPT_LL_RESOLV_LIST_SIZE          (4)
-#endif
-
-/*
- * Data length management definitions for connections. These define the maximum
- * size of the PDU's that will be sent and/or received in a connection.
- */
-#ifndef NIMBLE_OPT_LL_MAX_PKT_SIZE
-#define NIMBLE_OPT_LL_MAX_PKT_SIZE              (251)
-#endif
-
-#ifndef NIMBLE_OPT_LL_SUPP_MAX_RX_BYTES
-#define NIMBLE_OPT_LL_SUPP_MAX_RX_BYTES         (NIMBLE_OPT_LL_MAX_PKT_SIZE)
-#endif
-
-#ifndef NIMBLE_OPT_LL_SUPP_MAX_TX_BYTES
-#define NIMBLE_OPT_LL_SUPP_MAX_TX_BYTES         (NIMBLE_OPT_LL_MAX_PKT_SIZE)
-#endif
-
-#ifndef NIMBLE_OPT_LL_CONN_INIT_MAX_TX_BYTES
-#define NIMBLE_OPT_LL_CONN_INIT_MAX_TX_BYTES    (27)
-#endif
-
-/* The number of slots that will be allocated to each connection */
-#ifndef NIMBLE_OPT_LL_CONN_INIT_SLOTS
-#define NIMBLE_OPT_LL_CONN_INIT_SLOTS           (2)
-#endif
-
-/* The number of random bytes to store */
-#ifndef NIMBLE_OPT_LL_RNG_BUFSIZE
-#define NIMBLE_OPT_LL_RNG_BUFSIZE               (32)
-#endif
-
-/*
- * Configuration for LL supported features.
- *
- * There are a total 8 features that the LL can support. These can be found in
- * v4.2, Vol 6 Part B Section 4.6.
- *
- * These feature definitions are used to inform a host or other controller
- * about the LL features supported by the controller.
- *
- * NOTE: the controller always supports extended reject indicate and thus is
- * not listed here.
- */
-
- /*
-  * This option enables/disables encryption support in the controller. This
-  * option saves both both code and RAM.
-  */
-#ifndef BLE_LL_CFG_FEAT_LE_ENCRYPTION
-#define BLE_LL_CFG_FEAT_LE_ENCRYPTION           (1)
-#endif
-
-/*
- * This option enables/disables the connection parameter request procedure.
- * This is implemented in the controller but is disabled by default.
- */
-#ifndef BLE_LL_CFG_FEAT_CONN_PARAM_REQ
-#define BLE_LL_CFG_FEAT_CONN_PARAM_REQ          (0)
-#endif
-
-/*
- * This option allows a slave to initiate the feature exchange procedure.
- * This feature is implemented but currently has no impact on code or ram size
- */
-#ifndef BLE_LL_CFG_FEAT_SLAVE_INIT_FEAT_XCHG
-#define BLE_LL_CFG_FEAT_SLAVE_INIT_FEAT_XCHG    (1)
-#endif
-
-/*
- * This option allows a controller to send/receive LE pings. Currently,
- * this feature is not implemented by the controller so turning it on or off
- * has no effect.
- */
-#ifndef BLE_LL_CFG_FEAT_LE_PING
-#define  BLE_LL_CFG_FEAT_LE_PING                (1)
-#endif
-
-/*
- * This option enables/disables the data length update procedure in the
- * controller. If enabled, the controller is allowed to change the size of
- * tx/rx pdu's used in a connection. This option has only minor impact on
- * code size and non on RAM.
- */
-#ifndef BLE_LL_CFG_FEAT_DATA_LEN_EXT
-#define  BLE_LL_CFG_FEAT_DATA_LEN_EXT           (1)
-#endif
-
-/*
- * This option is used to enable/disable LL privacy. Currently, this feature
- * is not supported by the nimble controller.
- */
-#ifndef BLE_LL_CFG_FEAT_LL_PRIVACY
-#define BLE_LL_CFG_FEAT_LL_PRIVACY              (1)
-#endif
-
-/*
- * This option is used to enable/disable the extended scanner filter policy
- * feature. Currently, this feature is not supported by the nimble controller.
- */
-#ifndef BLE_LL_CFG_FEAT_EXT_SCAN_FILT
-#define  BLE_LL_CFG_FEAT_EXT_SCAN_FILT          (0)
-#endif
-
-/**
- * This macro exists to help catch bugs at compile time.  If code uses this
- * macro to check an option value, the compiler will complain when this header
- * is not included.  If the code checks the option symbol directly without
- * including this header, it will appear as though the option is set to 0.
- */
-#define NIMBLE_OPT(x)                           NIMBLE_OPT_ ## x
-
 /* Include automatically-generated settings. */
 #include "nimble/nimble_opt_auto.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/include/nimble/nimble_opt_auto.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/nimble_opt_auto.h b/net/nimble/include/nimble/nimble_opt_auto.h
index 2547c6c..536416f 100644
--- a/net/nimble/include/nimble/nimble_opt_auto.h
+++ b/net/nimble/include/nimble/nimble_opt_auto.h
@@ -20,6 +20,7 @@
 #ifndef H_NIMBLE_OPT_AUTO_
 #define H_NIMBLE_OPT_AUTO_
 
+#include "syscfg/syscfg.h"
 #include "nimble/nimble_opt.h"
 
 /***
@@ -29,78 +30,87 @@
  * in nimble_opt.h.
  */
 
-#undef NIMBLE_OPT_ADVERTISE
-#define NIMBLE_OPT_ADVERTISE                    \
-    (NIMBLE_OPT_ROLE_BROADCASTER || NIMBLE_OPT_ROLE_PERIPHERAL)
+#undef NIMBLE_BLE_ADVERTISE
+#define NIMBLE_BLE_ADVERTISE                    \
+    (MYNEWT_VAL(BLE_ROLE_BROADCASTER) || MYNEWT_VAL(BLE_ROLE_PERIPHERAL))
 
-#undef NIMBLE_OPT_SCAN
-#define NIMBLE_OPT_SCAN                         \
-    (NIMBLE_OPT_ROLE_CENTRAL || NIMBLE_OPT_ROLE_OBSERVER)
+#undef NIMBLE_BLE_SCAN
+#define NIMBLE_BLE_SCAN                         \
+    (MYNEWT_VAL(BLE_ROLE_CENTRAL) || MYNEWT_VAL(BLE_ROLE_OBSERVER))
 
-#undef NIMBLE_OPT_CONNECT
-#define NIMBLE_OPT_CONNECT                      \
-    (NIMBLE_OPT_ROLE_CENTRAL || NIMBLE_OPT_ROLE_PERIPHERAL)
+#undef NIMBLE_BLE_CONNECT
+#define NIMBLE_BLE_CONNECT                      \
+    (MYNEWT_VAL(BLE_ROLE_CENTRAL) || MYNEWT_VAL(BLE_ROLE_PERIPHERAL))
 
 
 /** Supported client ATT commands. */
 
-#undef NIMBLE_OPT_ATT_CLT_FIND_INFO
-#define NIMBLE_OPT_ATT_CLT_FIND_INFO            (NIMBLE_OPT_GATT_DISC_ALL_DSCS)
+#undef NIMBLE_BLE_ATT_CLT_FIND_INFO
+#define NIMBLE_BLE_ATT_CLT_FIND_INFO            \
+    (MYNEWT_VAL(BLE_GATT_DISC_ALL_DSCS))
 
-#undef NIMBLE_OPT_ATT_CLT_FIND_TYPE
-#define NIMBLE_OPT_ATT_CLT_FIND_TYPE            (NIMBLE_OPT_GATT_DISC_SVC_UUID)
+#undef NIMBLE_BLE_ATT_CLT_FIND_TYPE
+#define NIMBLE_BLE_ATT_CLT_FIND_TYPE            \
+    (MYNEWT_VAL(BLE_GATT_DISC_SVC_UUID))
 
-#undef NIMBLE_OPT_ATT_CLT_READ_TYPE
-#define NIMBLE_OPT_ATT_CLT_READ_TYPE            \
-    (NIMBLE_OPT_GATT_FIND_INC_SVCS ||           \
-     NIMBLE_OPT_GATT_DISC_ALL_CHRS ||           \
-     NIMBLE_OPT_GATT_DISC_CHRS_UUID ||          \
-     NIMBLE_OPT_GATT_READ_UUID)
+#undef NIMBLE_BLE_ATT_CLT_READ_TYPE
+#define NIMBLE_BLE_ATT_CLT_READ_TYPE            \
+    (MYNEWT_VAL(BLE_GATT_FIND_INC_SVCS) ||      \
+     MYNEWT_VAL(BLE_GATT_DISC_ALL_CHRS) ||      \
+     MYNEWT_VAL(BLE_GATT_DISC_CHRS_UUID) ||     \
+     MYNEWT_VAL(BLE_GATT_READ_UUID))
     
-#undef NIMBLE_OPT_ATT_CLT_READ
-#define NIMBLE_OPT_ATT_CLT_READ                 \
-    (NIMBLE_OPT_GATT_READ ||                    \
-     NIMBLE_OPT_GATT_READ_LONG ||               \
-     NIMBLE_OPT_GATT_FIND_INC_SVCS)
+#undef NIMBLE_BLE_ATT_CLT_READ
+#define NIMBLE_BLE_ATT_CLT_READ                 \
+    (MYNEWT_VAL(BLE_GATT_READ) ||               \
+     MYNEWT_VAL(BLE_GATT_READ_LONG) ||          \
+     MYNEWT_VAL(BLE_GATT_FIND_INC_SVCS))
 
-#undef NIMBLE_OPT_ATT_CLT_READ_BLOB
-#define NIMBLE_OPT_ATT_CLT_READ_BLOB            (NIMBLE_OPT_GATT_READ_LONG)
+#undef NIMBLE_BLE_ATT_CLT_READ_BLOB
+#define NIMBLE_BLE_ATT_CLT_READ_BLOB            \
+    (MYNEWT_VAL(BLE_GATT_READ_LONG))
 
-#undef NIMBLE_OPT_ATT_CLT_READ_MULT
-#define NIMBLE_OPT_ATT_CLT_READ_MULT            (NIMBLE_OPT_GATT_READ_MULT)
+#undef NIMBLE_BLE_ATT_CLT_READ_MULT
+#define NIMBLE_BLE_ATT_CLT_READ_MULT            \
+    (MYNEWT_VAL(BLE_GATT_READ_MULT))
 
-#undef NIMBLE_OPT_ATT_CLT_READ_GROUP_TYPE
-#define NIMBLE_OPT_ATT_CLT_READ_GROUP_TYPE      \
-    (NIMBLE_OPT_GATT_DISC_ALL_SVCS)
+#undef NIMBLE_BLE_ATT_CLT_READ_GROUP_TYPE
+#define NIMBLE_BLE_ATT_CLT_READ_GROUP_TYPE      \
+    (MYNEWT_VAL(BLE_GATT_DISC_ALL_SVCS))
 
-#undef NIMBLE_OPT_ATT_CLT_WRITE
-#define NIMBLE_OPT_ATT_CLT_WRITE                (NIMBLE_OPT_GATT_WRITE)
+#undef NIMBLE_BLE_ATT_CLT_WRITE
+#define NIMBLE_BLE_ATT_CLT_WRITE                \
+    (MYNEWT_VAL(BLE_GATT_WRITE))
 
-#undef NIMBLE_OPT_ATT_CLT_WRITE_NO_RSP
-#define NIMBLE_OPT_ATT_CLT_WRITE_NO_RSP         (NIMBLE_OPT_GATT_WRITE_NO_RSP)
+#undef NIMBLE_BLE_ATT_CLT_WRITE_NO_RSP
+#define NIMBLE_BLE_ATT_CLT_WRITE_NO_RSP         \
+    (MYNEWT_VAL(BLE_GATT_WRITE_NO_RSP))
 
-#undef NIMBLE_OPT_ATT_CLT_PREP_WRITE
-#define NIMBLE_OPT_ATT_CLT_PREP_WRITE           (NIMBLE_OPT_GATT_WRITE_LONG)
+#undef NIMBLE_BLE_ATT_CLT_PREP_WRITE
+#define NIMBLE_BLE_ATT_CLT_PREP_WRITE           \
+    (MYNEWT_VAL(BLE_GATT_WRITE_LONG))
 
-#undef NIMBLE_OPT_ATT_CLT_EXEC_WRITE
-#define NIMBLE_OPT_ATT_CLT_EXEC_WRITE           (NIMBLE_OPT_GATT_WRITE_LONG)
+#undef NIMBLE_BLE_ATT_CLT_EXEC_WRITE
+#define NIMBLE_BLE_ATT_CLT_EXEC_WRITE           \
+    (MYNEWT_VAL(BLE_GATT_WRITE_LONG))
 
-#undef NIMBLE_OPT_ATT_CLT_NOTIFY  
-#define NIMBLE_OPT_ATT_CLT_NOTIFY               (NIMBLE_OPT_GATT_NOTIFY)
+#undef NIMBLE_BLE_ATT_CLT_NOTIFY  
+#define NIMBLE_BLE_ATT_CLT_NOTIFY               \
+    (MYNEWT_VAL(BLE_GATT_NOTIFY))
 
-#undef NIMBLE_OPT_ATT_CLT_INDICATE
-#define NIMBLE_OPT_ATT_CLT_INDICATE             (NIMBLE_OPT_GATT_INDICATE)
+#undef NIMBLE_BLE_ATT_CLT_INDICATE
+#define NIMBLE_BLE_ATT_CLT_INDICATE             \
+    (MYNEWT_VAL(BLE_GATT_INDICATE))
 
 /** Security manager settings. */
 
+
 /* Secure connections implies security manager support
  * Note: For now, security manager is synonymous with legacy pairing.  In the
  * future, a new setting for legacy pairing may be introduced as a sibling of
  * the SC setting.
  */
-#if NIMBLE_OPT_SM_SC
-#undef NIMBLE_OPT_SM
-#define NIMBLE_OPT_SM                           1
-#endif
+#undef NIMBLE_BLE_SM
+#define NIMBLE_BLE_SM   (MYNEWT_VAL(BLE_SM) || MYNEWT_VAL(BLE_SM_SC))
 
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/pkg.yml
----------------------------------------------------------------------
diff --git a/net/nimble/pkg.yml b/net/nimble/pkg.yml
index ec9a473..10d2004 100644
--- a/net/nimble/pkg.yml
+++ b/net/nimble/pkg.yml
@@ -27,3 +27,25 @@ pkg.keywords:
 
 pkg.deps:
     - libs/os
+
+pkg.syscfg_defs:
+    # Supported GAP roles.  By default, all four roles are enabled.
+    BLE_ROLE_CENTRAL:
+        description: 'TBD'
+        value: 1
+    BLE_ROLE_PERIPHERAL:
+        description: 'TBD'
+        value: 1
+    BLE_ROLE_BROADCASTER:
+        description: 'TBD'
+        value: 1
+    BLE_ROLE_OBSERVER:
+        description: 'TBD'
+        value: 1
+
+    BLE_MAX_CONNECTIONS:
+        description: 'The maximum number of concurrent connections.'
+        value: 1
+    BLE_WHITELIST:
+        description: 'TBD'
+        value: 1

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/transport/ram/include/transport/ram/ble_hci_ram.h
----------------------------------------------------------------------
diff --git a/net/nimble/transport/ram/include/transport/ram/ble_hci_ram.h b/net/nimble/transport/ram/include/transport/ram/ble_hci_ram.h
index 9d2d672..4b0aed1 100644
--- a/net/nimble/transport/ram/include/transport/ram/ble_hci_ram.h
+++ b/net/nimble/transport/ram/include/transport/ram/ble_hci_ram.h
@@ -3,28 +3,6 @@
 
 #include "nimble/ble_hci_trans.h"
 
-struct ble_hci_ram_cfg {
-    /** Number of high-priority event buffers. */
-    uint16_t num_evt_hi_bufs;
-
-    /** Number of low-priority event buffers. */
-    uint16_t num_evt_lo_bufs;
-
-    /** Size of each event buffer, in bytes. */
-    uint16_t evt_buf_sz;
-
-    /* Note: For information about high-priority vs. low-priority event
-     * buffers, see net/nimble/include/nimble/ble_hci_trans.h.
-     */
-
-    /* Note: host-to-controller command buffers are not configurable.  The RAM
-     * transport only allows one outstanding command, so it uses a single
-     * statically-allocated buffer.
-     */
-};
-
-extern const struct ble_hci_ram_cfg ble_hci_ram_cfg_dflt;
-
-int ble_hci_ram_init(const struct ble_hci_ram_cfg *cfg);
+int ble_hci_ram_init(void);
 
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/transport/ram/pkg.yml
----------------------------------------------------------------------
diff --git a/net/nimble/transport/ram/pkg.yml b/net/nimble/transport/ram/pkg.yml
index a3524a1..3d551fe 100644
--- a/net/nimble/transport/ram/pkg.yml
+++ b/net/nimble/transport/ram/pkg.yml
@@ -31,3 +31,19 @@ pkg.deps:
 
 pkg.apis:
     - ble_transport
+
+pkg.init_function: ble_hci_ram_pkg_init
+pkg.init_stage: 1
+
+pkg.syscfg_defs:
+    BLE_HCI_EVT_HI_BUF_COUNT:
+        description: 'Number of high-priority event buffers.'
+        value:  1
+
+    BLE_HCI_EVT_LO_BUF_COUNT:
+        description: 'Number of low-priority event buffers.'
+        value:  2
+
+    BLE_HCI_EVT_BUF_SIZE:
+        description: 'Size of each event buffer, in bytes.'
+        value:  260

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/transport/ram/src/ble_hci_ram.c
----------------------------------------------------------------------
diff --git a/net/nimble/transport/ram/src/ble_hci_ram.c b/net/nimble/transport/ram/src/ble_hci_ram.c
index 2ce5fd6..cce6672 100644
--- a/net/nimble/transport/ram/src/ble_hci_ram.c
+++ b/net/nimble/transport/ram/src/ble_hci_ram.c
@@ -1,19 +1,14 @@
 #include <assert.h>
 #include <errno.h>
 #include <stddef.h>
+#include "sysinit/sysinit.h"
+#include "syscfg/syscfg.h"
 #include "os/os.h"
 #include "util/mem.h"
 #include "nimble/ble.h"
 #include "nimble/ble_hci_trans.h"
 #include "transport/ram/ble_hci_ram.h"
 
-/** Default configuration. */
-const struct ble_hci_ram_cfg ble_hci_ram_cfg_dflt = {
-    .num_evt_hi_bufs = 1,
-    .num_evt_lo_bufs = 2,
-    .evt_buf_sz = BLE_HCI_TRANS_CMD_SZ,
-};
-
 static ble_hci_trans_rx_cmd_fn *ble_hci_ram_rx_cmd_hs_cb;
 static void *ble_hci_ram_rx_cmd_hs_arg;
 
@@ -187,15 +182,15 @@ ble_hci_trans_reset(void)
  *                              A BLE_ERR_[...] error code on failure.
  */
 int
-ble_hci_ram_init(const struct ble_hci_ram_cfg *cfg)
+ble_hci_ram_init(void)
 {
     int rc;
 
     ble_hci_ram_free_mem();
 
     rc = mem_malloc_mempool(&ble_hci_ram_evt_hi_pool,
-                            cfg->num_evt_hi_bufs,
-                            cfg->evt_buf_sz,
+                            MYNEWT_VAL(BLE_HCI_EVT_HI_BUF_COUNT),
+                            MYNEWT_VAL(BLE_HCI_EVT_BUF_SIZE),
                             "ble_hci_ram_evt_hi_pool",
                             &ble_hci_ram_evt_hi_buf);
     if (rc != 0) {
@@ -204,8 +199,8 @@ ble_hci_ram_init(const struct ble_hci_ram_cfg *cfg)
     }
 
     rc = mem_malloc_mempool(&ble_hci_ram_evt_lo_pool,
-                            cfg->num_evt_lo_bufs,
-                            cfg->evt_buf_sz,
+                            MYNEWT_VAL(BLE_HCI_EVT_LO_BUF_COUNT),
+                            MYNEWT_VAL(BLE_HCI_EVT_BUF_SIZE),
                             "ble_hci_ram_evt_lo_pool",
                             &ble_hci_ram_evt_lo_buf);
     if (rc != 0) {
@@ -225,3 +220,12 @@ err:
     ble_hci_ram_free_mem();
     return rc;
 }
+
+void
+ble_hci_ram_pkg_init(void)
+{
+    int rc;
+
+    rc = ble_hci_ram_init();
+    SYSINIT_PANIC_ASSERT(rc == 0);
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/transport/uart/include/transport/uart/ble_hci_uart.h
----------------------------------------------------------------------
diff --git a/net/nimble/transport/uart/include/transport/uart/ble_hci_uart.h b/net/nimble/transport/uart/include/transport/uart/ble_hci_uart.h
index 1fbaa74..415b320 100644
--- a/net/nimble/transport/uart/include/transport/uart/ble_hci_uart.h
+++ b/net/nimble/transport/uart/include/transport/uart/ble_hci_uart.h
@@ -14,6 +14,6 @@ struct ble_hci_uart_cfg {
 
 extern const struct ble_hci_uart_cfg ble_hci_uart_cfg_dflt;
 
-int ble_hci_uart_init(const struct ble_hci_uart_cfg *cfg);
+int ble_hci_uart_init(void);
 
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/transport/uart/pkg.yml
----------------------------------------------------------------------
diff --git a/net/nimble/transport/uart/pkg.yml b/net/nimble/transport/uart/pkg.yml
index cce429c..56f0cda 100644
--- a/net/nimble/transport/uart/pkg.yml
+++ b/net/nimble/transport/uart/pkg.yml
@@ -32,3 +32,35 @@ pkg.deps:
 
 pkg.apis:
     - ble_transport
+
+pkg.syscfg_defs:
+    BLE_HCI_EVT_HI_BUF_COUNT:
+        description: 'TBD'
+        value:     8
+    BLE_HCI_EVT_LO_BUF_COUNT:
+        description: 'TBD'
+        value:     0
+
+    BLE_HCI_UART_BUF_SIZE:
+        description: 'TBD'
+        value: 260
+
+    BLE_HCI_UART_PORT:
+        description: 'TBD'
+        value:            0
+    BLE_HCI_UART_BAUD:
+        description: 'TBD'
+        value:            1000000
+    BLE_HCI_UART_DATA_BITS:
+        description: 'TBD'
+        value:       8
+    BLE_HCI_UART_STOP_BITS:
+        description: 'TBD'
+        value:       1
+    BLE_HCI_UART_PARITY:
+        description: 'TBD'
+        value:          HAL_UART_PARITY_NONE
+    BLE_HCI_UART_FLOW_CTRL:
+        description: 'TBD'
+        value:       HAL_UART_FLOW_CTL_RTS_CTS
+

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/net/nimble/transport/uart/src/ble_hci_uart.c
----------------------------------------------------------------------
diff --git a/net/nimble/transport/uart/src/ble_hci_uart.c b/net/nimble/transport/uart/src/ble_hci_uart.c
index 0fa982a..e7e07a1 100755
--- a/net/nimble/transport/uart/src/ble_hci_uart.c
+++ b/net/nimble/transport/uart/src/ble_hci_uart.c
@@ -36,6 +36,9 @@
 
 #include "transport/uart/ble_hci_uart.h"
 
+#define BLE_HCI_UART_EVT_COUNT  \
+    (MYNEWT_VAL(BLE_HCI_EVT_HI_BUF_COUNT) + MYNEWT_VAL(BLE_HCI_EVT_LO_BUF_COUNT))
+
 /***
  * NOTE:
  * The UART HCI transport doesn't use event buffer priorities.  All incoming
@@ -48,19 +51,6 @@
 #define BLE_HCI_UART_H4_SCO         0x03
 #define BLE_HCI_UART_H4_EVT         0x04
 
-/** Default configuration. */
-const struct ble_hci_uart_cfg ble_hci_uart_cfg_dflt = {
-    .uart_port = 0,
-    .baud = 1000000,
-    .flow_ctrl = HAL_UART_FLOW_CTL_RTS_CTS,
-    .data_bits = 8,
-    .stop_bits = 1,
-    .parity = HAL_UART_PARITY_NONE,
-
-    .num_evt_bufs = 8,
-    .evt_buf_sz = BLE_HCI_TRANS_CMD_SZ,
-};
-
 static ble_hci_trans_rx_cmd_fn *ble_hci_uart_rx_cmd_cb;
 static void *ble_hci_uart_rx_cmd_arg;
 
@@ -117,8 +107,6 @@ static struct {
     STAILQ_HEAD(, ble_hci_uart_pkt) tx_pkts; /* Packet queue to send to UART */
 } ble_hci_uart_state;
 
-static struct ble_hci_uart_cfg ble_hci_uart_cfg;
-
 static int
 ble_hci_uart_acl_tx(struct os_mbuf *om)
 {
@@ -138,7 +126,7 @@ ble_hci_uart_acl_tx(struct os_mbuf *om)
     STAILQ_INSERT_TAIL(&ble_hci_uart_state.tx_pkts, pkt, next);
     OS_EXIT_CRITICAL(sr);
 
-    hal_uart_start_tx(ble_hci_uart_cfg.uart_port);
+    hal_uart_start_tx(MYNEWT_VAL(BLE_HCI_UART_PORT));
 
     return 0;
 }
@@ -162,7 +150,7 @@ ble_hci_uart_cmdevt_tx(uint8_t *hci_ev, uint8_t h4_type)
     STAILQ_INSERT_TAIL(&ble_hci_uart_state.tx_pkts, pkt, next);
     OS_EXIT_CRITICAL(sr);
 
-    hal_uart_start_tx(ble_hci_uart_cfg.uart_port);
+    hal_uart_start_tx(MYNEWT_VAL(BLE_HCI_UART_PORT));
 
     return 0;
 }
@@ -463,19 +451,19 @@ ble_hci_uart_config(void)
 {
     int rc;
 
-    rc = hal_uart_init_cbs(ble_hci_uart_cfg.uart_port,
+    rc = hal_uart_init_cbs(MYNEWT_VAL(BLE_HCI_UART_PORT),
                            ble_hci_uart_tx_char, NULL,
                            ble_hci_uart_rx_char, NULL);
     if (rc != 0) {
         return BLE_ERR_UNSPECIFIED;
     }
 
-    rc = hal_uart_config(ble_hci_uart_cfg.uart_port,
-                         ble_hci_uart_cfg.baud,
-                         ble_hci_uart_cfg.data_bits,
-                         ble_hci_uart_cfg.stop_bits,
-                         ble_hci_uart_cfg.parity,
-                         ble_hci_uart_cfg.flow_ctrl);
+    rc = hal_uart_config(MYNEWT_VAL(BLE_HCI_UART_PORT),
+                         MYNEWT_VAL(BLE_HCI_UART_BAUD),
+                         MYNEWT_VAL(BLE_HCI_UART_DATA_BITS),
+                         MYNEWT_VAL(BLE_HCI_UART_STOP_BITS),
+                         MYNEWT_VAL(BLE_HCI_UART_PARITY),
+                         MYNEWT_VAL(BLE_HCI_UART_FLOW_CTRL));
     if (rc != 0) {
         return BLE_ERR_HW_FAIL;
     }
@@ -569,9 +557,9 @@ ble_hci_trans_hs_acl_tx(struct os_mbuf *om)
  */
 void
 ble_hci_trans_cfg_hs(ble_hci_trans_rx_cmd_fn *cmd_cb,
-                            void *cmd_arg,
-                            ble_hci_trans_rx_acl_fn *acl_cb,
-                            void *acl_arg)
+                     void *cmd_arg,
+                     ble_hci_trans_rx_acl_fn *acl_cb,
+                     void *acl_arg)
 {
     ble_hci_uart_set_rx_cbs(cmd_cb, cmd_arg, acl_cb, acl_arg);
 }
@@ -591,9 +579,9 @@ ble_hci_trans_cfg_hs(ble_hci_trans_rx_cmd_fn *cmd_cb,
  */
 void
 ble_hci_trans_cfg_ll(ble_hci_trans_rx_cmd_fn *cmd_cb,
-                            void *cmd_arg,
-                            ble_hci_trans_rx_acl_fn *acl_cb,
-                            void *acl_arg)
+                     void *cmd_arg,
+                     ble_hci_trans_rx_acl_fn *acl_cb,
+                     void *acl_arg)
 {
     ble_hci_uart_set_rx_cbs(cmd_cb, cmd_arg, acl_cb, acl_arg);
 }
@@ -656,7 +644,7 @@ ble_hci_trans_reset(void)
     int rc;
 
     /* Close the UART to prevent race conditions as the buffers are freed. */
-    rc = hal_uart_close(ble_hci_uart_cfg.uart_port);
+    rc = hal_uart_close(MYNEWT_VAL(BLE_HCI_UART_PORT));
     if (rc != 0) {
         return BLE_ERR_HW_FAIL;
     }
@@ -690,25 +678,20 @@ ble_hci_trans_reset(void)
 /**
  * Initializes the UART HCI transport module.
  *
- * @param cfg                   The settings to initialize the HCI UART
- *                                  transport with.
- *
  * @return                      0 on success;
  *                              A BLE_ERR_[...] error code on failure.
  */
 int
-ble_hci_uart_init(const struct ble_hci_uart_cfg *cfg)
+ble_hci_uart_init(void)
 {
     int rc;
 
     ble_hci_uart_free_mem();
 
-    ble_hci_uart_cfg = *cfg;
-
     /* Create memory pool of HCI command / event buffers */
     rc = mem_malloc_mempool(&ble_hci_uart_evt_pool,
-                            cfg->num_evt_bufs,
-                            cfg->evt_buf_sz,
+                            BLE_HCI_UART_EVT_COUNT,
+                            MYNEWT_VAL(BLE_HCI_UART_BUF_SIZE),
                             "ble_hci_uart_evt_pool",
                             &ble_hci_uart_evt_buf);
     if (rc != 0) {
@@ -718,7 +701,7 @@ ble_hci_uart_init(const struct ble_hci_uart_cfg *cfg)
 
     /* Create memory pool of packet list nodes. */
     rc = mem_malloc_mempool(&ble_hci_uart_pkt_pool,
-                            cfg->num_evt_bufs,
+                            BLE_HCI_UART_EVT_COUNT,
                             sizeof (struct ble_hci_uart_pkt),
                             "ble_hci_uart_pkt_pool",
                             &ble_hci_uart_pkt_buf);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/include/config/config.h
----------------------------------------------------------------------
diff --git a/sys/config/include/config/config.h b/sys/config/include/config/config.h
index 3402b46..bc8e7d2 100644
--- a/sys/config/include/config/config.h
+++ b/sys/config/include/config/config.h
@@ -57,13 +57,15 @@ struct conf_handler {
       enum conf_export_tgt tgt);
 };
 
-int conf_init(void);
+void conf_init(void);
 int conf_register(struct conf_handler *);
 int conf_load(void);
 
 int conf_save(void);
 int conf_save_one(const char *name, char *var);
 
+void conf_store_init(void);
+
 /*
   XXXX for later
   int conf_save_lib(char *name);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/config/pkg.yml b/sys/config/pkg.yml
index a31f33e..e005530 100644
--- a/sys/config/pkg.yml
+++ b/sys/config/pkg.yml
@@ -25,23 +25,44 @@ pkg.keywords:
 
 pkg.deps:
     - libs/util
-    - libs/testutil
-pkg.deps.SHELL:
+pkg.deps.CONFIG_CLI:
     - libs/shell
-pkg.req_apis.SHELL:
-    - console
-pkg.cflags.SHELL: -DSHELL_PRESENT
-pkg.deps.NEWTMGR:
+pkg.deps.CONFIG_NEWTMGR:
     - libs/newtmgr
     - libs/json
-pkg.cflags.NEWTMGR: -DNEWTMGR_PRESENT
-pkg.deps.FCB:
+pkg.deps.CONFIG_FCB:
     - sys/fcb
-pkg.cflags.FCB: -DFCB_PRESENT
-pkg.deps.FS:
-    - fs/fs
-pkg.cflags.FS: -DFS_PRESENT
-
-pkg.deps.TEST:
+pkg.deps.CONFIG_NFFS:
     - fs/nffs
-    - sys/fcb
+
+pkg.init_function: config_pkg_init
+pkg.init_stage: 5
+
+pkg.syscfg_defs:
+    CONFIG_FCB:
+        description: 'TBD'
+        value: 1
+    CONFIG_FCB_MAGIC:
+        description: 'TBD'
+        value: 0xc09f6e5e
+
+    CONFIG_NFFS:
+        description: 'TBD'
+        value: 'MYNEWT_PKG_FS_NFFS'
+    CONFIG_NFFS_DIR:
+        description: 'TBD'
+        value: '"/cfg"'
+    CONFIG_NFFS_FILE:
+        description: 'TBD'
+        value: '"/cfg/run"'
+    CONFIG_NFFS_MAX_LINES:
+        description: 'TBD'
+        value: 32
+
+    CONFIG_NEWTMGR:
+        description: 'TBD'
+        value: 0
+
+    CONFIG_CLI:
+        description: 'TBD'
+        value: 0

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/config.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config.c b/sys/config/src/config.c
index c21cec7..e37efb8 100644
--- a/sys/config/src/config.c
+++ b/sys/config/src/config.c
@@ -20,37 +20,42 @@
 #include <string.h>
 #include <stdio.h>
 
-#include <os/os.h>
-#include <util/base64.h>
+#include "sysinit/sysinit.h"
+#include "syscfg/syscfg.h"
+#include "os/os.h"
+#include "util/base64.h"
 
 #include "config/config.h"
 #include "config_priv.h"
 
-struct conf_handler_head conf_handlers = SLIST_HEAD_INITIALIZER(&conf_handlers);
+struct conf_handler_head conf_handlers;
 
 static uint8_t conf_cmd_inited;
 
-int
+void
 conf_init(void)
 {
     int rc;
 
-    rc = 0;
+    SLIST_INIT(&conf_handlers);
+    conf_store_init();
+
     if (conf_cmd_inited) {
-        goto done;
+        return;
     }
-#ifdef SHELL_PRESENT
+
+    (void)rc;
+
+#if MYNEWT_VAL(CONFIG_CLI)
     rc = conf_cli_register();
+    SYSINIT_PANIC_ASSERT(rc == 0);
 #endif
-#ifdef NEWTMGR_PRESENT
+#if MYNEWT_VAL(CONFIG_NEWTMGR)
     rc = conf_nmgr_register();
+    SYSINIT_PANIC_ASSERT(rc == 0);
 #endif
-    if (!rc) {
-        conf_cmd_inited = 1;
-    }
 
-done:
-    return rc;
+    conf_cmd_inited = 1;
 }
 
 int

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/config_cli.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_cli.c b/sys/config/src/config_cli.c
index 2923845..7cd2a3d 100644
--- a/sys/config/src/config_cli.c
+++ b/sys/config/src/config_cli.c
@@ -19,10 +19,11 @@
 
 #include <stddef.h>
 
+#include "syscfg/syscfg.h"
 #include "config/config.h"
 #include "config_priv.h"
 
-#ifdef SHELL_PRESENT
+#if MYNEWT_VAL(CONFIG_CLI)
 #include <string.h>
 
 #include <shell/shell.h>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/config_fcb.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_fcb.c b/sys/config/src/config_fcb.c
index cc6debf..94a772f 100644
--- a/sys/config/src/config_fcb.c
+++ b/sys/config/src/config_fcb.c
@@ -17,7 +17,10 @@
  * under the License.
  */
 
-#ifdef FCB_PRESENT
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(CONFIG_FCB)
+
 #include <os/os.h>
 #include <fcb/fcb.h>
 #include <string.h>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/config_file.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_file.c b/sys/config/src/config_file.c
index c6d744d..fd518d5 100644
--- a/sys/config/src/config_file.c
+++ b/sys/config/src/config_file.c
@@ -17,7 +17,9 @@
  * under the License.
  */
 
-#ifdef FS_PRESENT
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(CONFIG_NFFS)
 
 #include <string.h>
 #include <assert.h>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/config_init.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_init.c b/sys/config/src/config_init.c
new file mode 100644
index 0000000..0b3a503
--- /dev/null
+++ b/sys/config/src/config_init.c
@@ -0,0 +1,105 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+
+#include "sysinit/sysinit.h"
+#include "syscfg/syscfg.h"
+#include "sysinit/sysinit.h"
+#include "bsp/bsp.h"
+
+#include "config/config.h"
+#include "config/config_file.h"
+
+#if MYNEWT_VAL(CONFIG_NFFS)
+#include "fs/fs.h"
+
+static struct conf_file config_init_conf_file = {
+    .cf_name = MYNEWT_VAL(CONFIG_NFFS_FILE),
+    .cf_maxlines = MYNEWT_VAL(CONFIG_NFFS_MAX_LINES)
+};
+
+static void
+config_init_fs(void)
+{
+    int rc;
+
+    fs_mkdir(MYNEWT_VAL(CONFIG_NFFS_DIR));
+    rc = conf_file_src(&config_init_conf_file);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+    rc = conf_file_dst(&config_init_conf_file);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+}
+
+#elif MYNEWT_VAL(CONFIG_FCB)
+#include "fcb/fcb.h"
+#include "config/config_fcb.h"
+
+static struct flash_area conf_fcb_area[NFFS_AREA_MAX + 1];
+
+static struct conf_fcb config_init_conf_fcb = {
+    .cf_fcb.f_magic = MYNEWT_VAL(CONFIG_FCB_MAGIC),
+    .cf_fcb.f_sectors = conf_fcb_area,
+};
+
+static void
+config_init_fcb(void)
+{
+    int cnt;
+    int rc;
+
+    rc = flash_area_to_sectors(FLASH_AREA_NFFS, &cnt, NULL);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+    SYSINIT_PANIC_ASSERT(
+        cnt <= sizeof(conf_fcb_area) / sizeof(conf_fcb_area[0]));
+    flash_area_to_sectors(FLASH_AREA_NFFS, &cnt, conf_fcb_area);
+
+    config_init_conf_fcb.cf_fcb.f_sector_cnt = cnt;
+
+    rc = conf_fcb_src(&config_init_conf_fcb);
+    if (rc) {
+        for (cnt = 0;
+             cnt < config_init_conf_fcb.cf_fcb.f_sector_cnt;
+             cnt++) {
+
+            flash_area_erase(&conf_fcb_area[cnt], 0,
+                             conf_fcb_area[cnt].fa_size);
+        }
+        rc = conf_fcb_src(&config_init_conf_fcb);
+    }
+    SYSINIT_PANIC_ASSERT(rc == 0);
+    rc = conf_fcb_dst(&config_init_conf_fcb);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+}
+
+#else
+#error "Need NFFS or FCB for config storage"
+#endif
+
+void
+config_pkg_init(void)
+{
+    conf_init();
+
+#if MYNEWT_VAL(CONFIG_NFFS)
+    config_init_fs();
+#elif MYNEWT_VAL(CONFIG_FCB)
+    config_init_fcb();
+#endif
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/config_json_line.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_json_line.c b/sys/config/src/config_json_line.c
index d8dc745..219ca85 100644
--- a/sys/config/src/config_json_line.c
+++ b/sys/config/src/config_json_line.c
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-#ifdef NEWTMGR_PRESENT
+
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(CONFIG_NEWTMGR)
 
 #include "config/config.h"
 #include "config_priv.h"
-
-#include <json/json.h>
+#include "json/json.h"
 
 int
 conf_json_line(struct json_buffer *jb, char *name, int nlen, char *value,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/config_nmgr.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_nmgr.c b/sys/config/src/config_nmgr.c
index ae4aa11..2470b00 100644
--- a/sys/config/src/config_nmgr.c
+++ b/sys/config/src/config_nmgr.c
@@ -17,12 +17,14 @@
  * under the License.
  */
 
-#ifdef NEWTMGR_PRESENT
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(CONFIG_NEWTMGR)
 
 #include <string.h>
 
-#include <newtmgr/newtmgr.h>
-#include <json/json.h>
+#include "newtmgr/newtmgr.h"
+#include "json/json.h"
 
 #include "config/config.h"
 #include "config_priv.h"

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/config_store.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_store.c b/sys/config/src/config_store.c
index 87f9955..8ae3472 100644
--- a/sys/config/src/config_store.c
+++ b/sys/config/src/config_store.c
@@ -31,7 +31,7 @@ struct conf_dup_check_arg {
     int is_dup;
 };
 
-struct conf_store_head conf_load_srcs = SLIST_HEAD_INITIALIZER(&conf_load_srcs);
+struct conf_store_head conf_load_srcs;
 struct conf_store *conf_save_dst;
 
 void
@@ -170,3 +170,9 @@ conf_save(void)
     }
     return rc;
 }
+
+void
+conf_store_init(void)
+{
+    SLIST_INIT(&conf_load_srcs);
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/test/conf_test.c
----------------------------------------------------------------------
diff --git a/sys/config/src/test/conf_test.c b/sys/config/src/test/conf_test.c
deleted file mode 100644
index cde1cca..0000000
--- a/sys/config/src/test/conf_test.c
+++ /dev/null
@@ -1,953 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#include <stdio.h>
-#include <string.h>
-
-#include <os/os.h>
-#include <testutil/testutil.h>
-#include <nffs/nffs.h>
-#include <fs/fs.h>
-#include <fs/fsutil.h>
-#include <fcb/fcb.h>
-#include "config/config.h"
-#include "config/config_file.h"
-#include "config/config_fcb.h"
-#include "test/config_test.h"
-#include "config/../../src/config_priv.h"
-
-static uint8_t val8;
-int c2_var_count = 1;
-static char val_string[64][CONF_MAX_VAL_LEN];
-
-static uint32_t val32;
-
-static int test_get_called;
-static int test_set_called;
-static int test_commit_called;
-static int test_export_block;
-
-static char *ctest_handle_get(int argc, char **argv, char *val,
-  int val_len_max);
-static int ctest_handle_set(int argc, char **argv, char *val);
-static int ctest_handle_commit(void);
-static int ctest_handle_export(void (*cb)(char *name, char *value),
-  enum conf_export_tgt tgt);
-static char *c2_handle_get(int argc, char **argv, char *val,
-  int val_len_max);
-static int c2_handle_set(int argc, char **argv, char *val);
-static int c2_handle_export(void (*cb)(char *name, char *value),
-  enum conf_export_tgt tgt);
-static char *c3_handle_get(int argc, char **argv, char *val,
-  int val_len_max);
-static int c3_handle_set(int argc, char **argv, char *val);
-static int c3_handle_export(void (*cb)(char *name, char *value),
-  enum conf_export_tgt tgt);
-
-struct conf_handler config_test_handler = {
-    .ch_name = "myfoo",
-    .ch_get = ctest_handle_get,
-    .ch_set = ctest_handle_set,
-    .ch_commit = ctest_handle_commit,
-    .ch_export = ctest_handle_export
-};
-
-static char *
-ctest_handle_get(int argc, char **argv, char *val, int val_len_max)
-{
-    test_get_called = 1;
-    if (argc == 1 && !strcmp(argv[0], "mybar")) {
-        return conf_str_from_value(CONF_INT8, &val8, val, val_len_max);
-    }
-    return NULL;
-}
-
-static int
-ctest_handle_set(int argc, char **argv, char *val)
-{
-    uint8_t newval;
-    int rc;
-
-    test_set_called = 1;
-    if (argc == 1 && !strcmp(argv[0], "mybar")) {
-        rc = CONF_VALUE_SET(val, CONF_INT8, newval);
-        TEST_ASSERT(rc == 0);
-        val8 = newval;
-        return 0;
-    }
-    return OS_ENOENT;
-}
-
-static int
-ctest_handle_commit(void)
-{
-    test_commit_called = 1;
-    return 0;
-}
-
-static int
-ctest_handle_export(void (*cb)(char *name, char *value),
-  enum conf_export_tgt tgt)
-{
-    char value[32];
-
-    if (test_export_block) {
-        return 0;
-    }
-    conf_str_from_value(CONF_INT8, &val8, value, sizeof(value));
-    cb("myfoo/mybar", value);
-
-    return 0;
-}
-
-struct conf_handler c2_test_handler = {
-    .ch_name = "2nd",
-    .ch_get = c2_handle_get,
-    .ch_set = c2_handle_set,
-    .ch_commit = NULL,
-    .ch_export = c2_handle_export
-};
-
-char *
-c2_var_find(char *name)
-{
-    int idx = 0;
-    int len;
-    char *eptr;
-
-    len = strlen(name);
-    TEST_ASSERT(!strncmp(name, "string", 6));
-    TEST_ASSERT(len > 6);
-
-    idx = strtoul(&name[6], &eptr, 10);
-    TEST_ASSERT(*eptr == '\0');
-    TEST_ASSERT(idx < c2_var_count);
-    return val_string[idx];
-}
-
-static char *
-c2_handle_get(int argc, char **argv, char *val, int val_len_max)
-{
-    int len;
-    char *valptr;
-
-    if (argc == 1) {
-        valptr = c2_var_find(argv[0]);
-        if (!valptr) {
-            return NULL;
-        }
-        len = strlen(val_string[0]);
-        if (len > val_len_max) {
-            len = val_len_max;
-        }
-        strncpy(val, valptr, len);
-    }
-    return NULL;
-}
-
-static int
-c2_handle_set(int argc, char **argv, char *val)
-{
-    char *valptr;
-
-    if (argc == 1) {
-        valptr = c2_var_find(argv[0]);
-        if (!valptr) {
-            return OS_ENOENT;
-        }
-        if (val) {
-            strncpy(valptr, val, sizeof(val_string[0]));
-        } else {
-            memset(valptr, 0, sizeof(val_string[0]));
-        }
-        return 0;
-    }
-    return OS_ENOENT;
-}
-
-static int
-c2_handle_export(void (*cb)(char *name, char *value),
-  enum conf_export_tgt tgt)
-{
-    int i;
-    char name[32];
-
-    for (i = 0; i < c2_var_count; i++) {
-        snprintf(name, sizeof(name), "2nd/string%d", i);
-        cb(name, val_string[i]);
-    }
-    return 0;
-}
-
-struct conf_handler c3_test_handler = {
-    .ch_name = "3",
-    .ch_get = c3_handle_get,
-    .ch_set = c3_handle_set,
-    .ch_commit = NULL,
-    .ch_export = c3_handle_export
-};
-
-static char *
-c3_handle_get(int argc, char **argv, char *val, int val_len_max)
-{
-    if (argc == 1 && !strcmp(argv[0], "v")) {
-        return conf_str_from_value(CONF_INT32, &val32, val, val_len_max);
-    }
-    return NULL;
-}
-
-static int
-c3_handle_set(int argc, char **argv, char *val)
-{
-    uint32_t newval;
-    int rc;
-
-    if (argc == 1 && !strcmp(argv[0], "v")) {
-        rc = CONF_VALUE_SET(val, CONF_INT32, newval);
-        TEST_ASSERT(rc == 0);
-        val32 = newval;
-        return 0;
-    }
-    return OS_ENOENT;
-}
-
-static int
-c3_handle_export(void (*cb)(char *name, char *value),
-  enum conf_export_tgt tgt)
-{
-    char value[32];
-
-    conf_str_from_value(CONF_INT32, &val32, value, sizeof(value));
-    cb("3/v", value);
-
-    return 0;
-}
-
-static void
-ctest_clear_call_state(void)
-{
-    test_get_called = 0;
-    test_set_called = 0;
-    test_commit_called = 0;
-}
-
-static int
-ctest_get_call_state(void)
-{
-    return test_get_called + test_set_called + test_commit_called;
-}
-
-TEST_CASE(config_empty_lookups)
-{
-    int rc;
-    char name[80];
-    char tmp[64], *str;
-
-    strcpy(name, "foo/bar");
-    rc = conf_set_value(name, "tmp");
-    TEST_ASSERT(rc != 0);
-
-    strcpy(name, "foo/bar");
-    str = conf_get_value(name, tmp, sizeof(tmp));
-    TEST_ASSERT(str == NULL);
-}
-
-TEST_CASE(config_test_insert)
-{
-    int rc;
-
-    rc = conf_register(&config_test_handler);
-    TEST_ASSERT(rc == 0);
-}
-
-TEST_CASE(config_test_insert2)
-{
-    int rc;
-
-    rc = conf_register(&c2_test_handler);
-    TEST_ASSERT(rc == 0);
-}
-
-TEST_CASE(config_test_getset_unknown)
-{
-    char name[80];
-    char tmp[64], *str;
-    int rc;
-
-    strcpy(name, "foo/bar");
-    rc = conf_set_value(name, "tmp");
-    TEST_ASSERT(rc != 0);
-    TEST_ASSERT(ctest_get_call_state() == 0);
-
-    strcpy(name, "foo/bar");
-    str = conf_get_value(name, tmp, sizeof(tmp));
-    TEST_ASSERT(str == NULL);
-    TEST_ASSERT(ctest_get_call_state() == 0);
-
-    strcpy(name, "myfoo/bar");
-    rc = conf_set_value(name, "tmp");
-    TEST_ASSERT(rc == OS_ENOENT);
-    TEST_ASSERT(test_set_called == 1);
-    ctest_clear_call_state();
-
-    strcpy(name, "myfoo/bar");
-    str = conf_get_value(name, tmp, sizeof(tmp));
-    TEST_ASSERT(str == NULL);
-    TEST_ASSERT(test_get_called == 1);
-    ctest_clear_call_state();
-}
-
-TEST_CASE(config_test_getset_int)
-{
-    char name[80];
-    char tmp[64], *str;
-    int rc;
-
-    strcpy(name, "myfoo/mybar");
-    rc = conf_set_value(name, "42");
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(test_set_called == 1);
-    TEST_ASSERT(val8 == 42);
-    ctest_clear_call_state();
-
-    strcpy(name, "myfoo/mybar");
-    str = conf_get_value(name, tmp, sizeof(tmp));
-    TEST_ASSERT(str);
-    TEST_ASSERT(test_get_called == 1);
-    TEST_ASSERT(!strcmp("42", tmp));
-    ctest_clear_call_state();
-}
-
-TEST_CASE(config_test_getset_bytes)
-{
-    char orig[32];
-    char bytes[32];
-    char str[48];
-    char *ret;
-    int j, i;
-    int tmp;
-    int rc;
-
-    for (j = 1; j < sizeof(orig); j++) {
-        for (i = 0; i < j; i++) {
-            orig[i] = i + j + 1;
-        }
-        ret = conf_str_from_bytes(orig, j, str, sizeof(str));
-        TEST_ASSERT(ret);
-        tmp = strlen(str);
-        TEST_ASSERT(tmp < sizeof(str));
-
-        memset(bytes, 0, sizeof(bytes));
-        tmp = sizeof(bytes);
-
-        tmp = sizeof(bytes);
-        rc = conf_bytes_from_str(str, bytes, &tmp);
-        TEST_ASSERT(rc == 0);
-        TEST_ASSERT(tmp == j);
-        TEST_ASSERT(!memcmp(orig, bytes, j));
-    }
-}
-
-TEST_CASE(config_test_commit)
-{
-    char name[80];
-    int rc;
-
-    strcpy(name, "bar");
-    rc = conf_commit(name);
-    TEST_ASSERT(rc);
-    TEST_ASSERT(ctest_get_call_state() == 0);
-
-    rc = conf_commit(NULL);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(test_commit_called == 1);
-    ctest_clear_call_state();
-
-    strcpy(name, "myfoo");
-    rc = conf_commit(name);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(test_commit_called == 1);
-    ctest_clear_call_state();
-}
-
-static const struct nffs_area_desc config_nffs[] = {
-    { 0x00000000, 16 * 1024 },
-    { 0x00004000, 16 * 1024 },
-    { 0x00008000, 16 * 1024 },
-    { 0x0000c000, 16 * 1024 },
-    { 0, 0 }
-};
-
-TEST_CASE(config_setup_nffs)
-{
-    int rc;
-
-    rc = nffs_init();
-    TEST_ASSERT_FATAL(rc == 0);
-    rc = nffs_format(config_nffs);
-    TEST_ASSERT_FATAL(rc == 0);
-}
-
-static void config_wipe_srcs(void)
-{
-    SLIST_INIT(&conf_load_srcs);
-    conf_save_dst = NULL;
-}
-
-static void config_wipe_fcb(struct flash_area *fa, int cnt)
-{
-    int i;
-
-    for (i = 0; i < cnt; i++) {
-        flash_area_erase(&fa[i], 0, fa[i].fa_size);
-    }
-}
-
-TEST_CASE(config_test_empty_file)
-{
-    int rc;
-    struct conf_file cf_mfg;
-    struct conf_file cf_running;
-    const char cf_mfg_test[] = "";
-    const char cf_running_test[] = "\n\n";
-
-    config_wipe_srcs();
-
-    cf_mfg.cf_name = "/config/mfg";
-    cf_running.cf_name = "/config/running";
-
-    rc = conf_file_src(&cf_mfg);
-    TEST_ASSERT(rc == 0);
-    rc = conf_file_src(&cf_running);
-
-    /*
-     * No files
-     */
-    conf_load();
-
-    rc = fs_mkdir("/config");
-    TEST_ASSERT(rc == 0);
-
-    rc = fsutil_write_file("/config/mfg", cf_mfg_test, sizeof(cf_mfg_test));
-    TEST_ASSERT(rc == 0);
-
-    rc = fsutil_write_file("/config/running", cf_running_test,
-      sizeof(cf_running_test));
-    TEST_ASSERT(rc == 0);
-
-    conf_load();
-    config_wipe_srcs();
-    ctest_clear_call_state();
-}
-
-TEST_CASE(config_test_small_file)
-{
-    int rc;
-    struct conf_file cf_mfg;
-    struct conf_file cf_running;
-    const char cf_mfg_test[] = "myfoo/mybar=1";
-    const char cf_running_test[] = " myfoo/mybar = 8 ";
-
-    config_wipe_srcs();
-
-    cf_mfg.cf_name = "/config/mfg";
-    cf_running.cf_name = "/config/running";
-
-    rc = conf_file_src(&cf_mfg);
-    TEST_ASSERT(rc == 0);
-    rc = conf_file_src(&cf_running);
-
-    rc = fsutil_write_file("/config/mfg", cf_mfg_test, sizeof(cf_mfg_test));
-    TEST_ASSERT(rc == 0);
-
-    conf_load();
-    TEST_ASSERT(test_set_called);
-    TEST_ASSERT(val8 == 1);
-
-    ctest_clear_call_state();
-
-    rc = fsutil_write_file("/config/running", cf_running_test,
-      sizeof(cf_running_test));
-    TEST_ASSERT(rc == 0);
-
-    conf_load();
-    TEST_ASSERT(test_set_called);
-    TEST_ASSERT(val8 == 8);
-
-    ctest_clear_call_state();
-}
-
-TEST_CASE(config_test_multiple_in_file)
-{
-    int rc;
-    struct conf_file cf_mfg;
-    const char cf_mfg_test1[] =
-      "myfoo/mybar=1\n"
-      "myfoo/mybar=14";
-    const char cf_mfg_test2[] =
-      "myfoo/mybar=1\n"
-      "myfoo/mybar=15\n"
-      "\n";
-
-    config_wipe_srcs();
-
-    cf_mfg.cf_name = "/config/mfg";
-    rc = conf_file_src(&cf_mfg);
-    TEST_ASSERT(rc == 0);
-
-    rc = fsutil_write_file("/config/mfg", cf_mfg_test1, sizeof(cf_mfg_test1));
-    TEST_ASSERT(rc == 0);
-
-    conf_load();
-    TEST_ASSERT(test_set_called);
-    TEST_ASSERT(val8 == 14);
-
-    rc = fsutil_write_file("/config/mfg", cf_mfg_test2, sizeof(cf_mfg_test2));
-    TEST_ASSERT(rc == 0);
-
-    conf_load();
-    TEST_ASSERT(test_set_called);
-    TEST_ASSERT(val8 == 15);
-}
-
-int
-conf_test_file_strstr(const char *fname, char *string)
-{
-    int rc;
-    uint32_t len;
-    uint32_t rlen;
-    char *buf;
-    struct fs_file *file;
-
-    rc = fs_open(fname, FS_ACCESS_READ, &file);
-    if (rc) {
-        return rc;
-    }
-    rc = fs_filelen(file, &len);
-    fs_close(file);
-    if (rc) {
-        return rc;
-    }
-
-    buf = (char *)malloc(len + 1);
-    TEST_ASSERT(buf);
-
-    rc = fsutil_read_file(fname, 0, len, buf, &rlen);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(rlen == len);
-    buf[rlen] = '\0';
-
-    if (strstr(buf, string)) {
-        return 0;
-    } else {
-        return -1;
-    }
-}
-
-TEST_CASE(config_test_save_in_file)
-{
-    int rc;
-    struct conf_file cf;
-
-    config_wipe_srcs();
-
-    rc = fs_mkdir("/config");
-    TEST_ASSERT(rc == 0 || rc == FS_EEXIST);
-
-    cf.cf_name = "/config/blah";
-    rc = conf_file_src(&cf);
-    TEST_ASSERT(rc == 0);
-    rc = conf_file_dst(&cf);
-    TEST_ASSERT(rc == 0);
-
-    val8 = 8;
-    rc = conf_save();
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_test_file_strstr(cf.cf_name, "myfoo/mybar=8\n");
-    TEST_ASSERT(rc == 0);
-
-    val8 = 43;
-    rc = conf_save();
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_test_file_strstr(cf.cf_name, "myfoo/mybar=43\n");
-    TEST_ASSERT(rc == 0);
-}
-
-TEST_CASE(config_test_save_one_file)
-{
-    int rc;
-    struct conf_file cf;
-
-    config_wipe_srcs();
-    rc = fs_mkdir("/config");
-    TEST_ASSERT(rc == 0 || rc == FS_EEXIST);
-
-    cf.cf_name = "/config/blah";
-    rc = conf_file_src(&cf);
-    TEST_ASSERT(rc == 0);
-    rc = conf_file_dst(&cf);
-    TEST_ASSERT(rc == 0);
-
-    val8 = 33;
-    rc = conf_save();
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_save_one("myfoo/mybar", "42");
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_load();
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(val8 == 42);
-
-    rc = conf_save_one("myfoo/mybar", "44");
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_load();
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(val8 == 44);
-}
-
-struct flash_area fcb_areas[] = {
-    [0] = {
-        .fa_off = 0x00000000,
-        .fa_size = 16 * 1024
-    },
-    [1] = {
-        .fa_off = 0x00004000,
-        .fa_size = 16 * 1024
-    },
-    [2] = {
-        .fa_off = 0x00008000,
-        .fa_size = 16 * 1024
-    },
-    [3] = {
-        .fa_off = 0x0000c000,
-        .fa_size = 16 * 1024
-    }
-};
-
-TEST_CASE(config_test_empty_fcb)
-{
-    int rc;
-    struct conf_fcb cf;
-
-    config_wipe_srcs();
-    config_wipe_fcb(fcb_areas, sizeof(fcb_areas) / sizeof(fcb_areas[0]));
-
-    cf.cf_fcb.f_sectors = fcb_areas;
-    cf.cf_fcb.f_sector_cnt = sizeof(fcb_areas) / sizeof(fcb_areas[0]);
-
-    rc = conf_fcb_src(&cf);
-    TEST_ASSERT(rc == 0);
-
-    /*
-     * No values
-     */
-    conf_load();
-
-    config_wipe_srcs();
-    ctest_clear_call_state();
-}
-
-TEST_CASE(config_test_save_1_fcb)
-{
-    int rc;
-    struct conf_fcb cf;
-
-    config_wipe_srcs();
-
-    cf.cf_fcb.f_sectors = fcb_areas;
-    cf.cf_fcb.f_sector_cnt = sizeof(fcb_areas) / sizeof(fcb_areas[0]);
-
-    rc = conf_fcb_src(&cf);
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_fcb_dst(&cf);
-    TEST_ASSERT(rc == 0);
-
-    val8 = 33;
-    rc = conf_save();
-    TEST_ASSERT(rc == 0);
-
-    val8 = 0;
-
-    rc = conf_load();
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(val8 == 33);
-}
-
-static void config_test_fill_area(char test_value[64][CONF_MAX_VAL_LEN],
-  int iteration)
-{
-      int i, j;
-
-      for (j = 0; j < 64; j++) {
-          for (i = 0; i < CONF_MAX_VAL_LEN; i++) {
-              test_value[j][i] = ((j * 2) + i + iteration) % 10 + '0';
-          }
-          test_value[j][sizeof(test_value[j]) - 1] = '\0';
-      }
-}
-
-TEST_CASE(config_test_save_2_fcb)
-{
-    int rc;
-    struct conf_fcb cf;
-    char test_value[64][CONF_MAX_VAL_LEN];
-    int i;
-
-    config_wipe_srcs();
-
-    cf.cf_fcb.f_sectors = fcb_areas;
-    cf.cf_fcb.f_sector_cnt = sizeof(fcb_areas) / sizeof(fcb_areas[0]);
-
-    rc = conf_fcb_src(&cf);
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_fcb_dst(&cf);
-    TEST_ASSERT(rc == 0);
-
-    config_test_fill_area(test_value, 0);
-    memcpy(val_string, test_value, sizeof(val_string));
-
-    val8 = 42;
-    rc = conf_save();
-    TEST_ASSERT(rc == 0);
-
-    val8 = 0;
-    memset(val_string[0], 0, sizeof(val_string[0]));
-    rc = conf_load();
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(val8 == 42);
-    TEST_ASSERT(!strcmp(val_string[0], test_value[0]));
-    test_export_block = 1;
-
-    /*
-     * Now add the number of settings to max. Keep adjusting the test_data,
-     * check that rollover happens when it's supposed to.
-     */
-    c2_var_count = 64;
-
-    for (i = 0; i < 32; i++) {
-        config_test_fill_area(test_value, i);
-        memcpy(val_string, test_value, sizeof(val_string));
-
-        rc = conf_save();
-        TEST_ASSERT(rc == 0);
-
-        memset(val_string, 0, sizeof(val_string));
-
-        val8 = 0;
-        rc = conf_load();
-        TEST_ASSERT(rc == 0);
-        TEST_ASSERT(!memcmp(val_string, test_value, sizeof(val_string)));
-        TEST_ASSERT(val8 == 42);
-    }
-    c2_var_count = 0;
-}
-
-TEST_CASE(config_test_insert3)
-{
-    int rc;
-
-    rc = conf_register(&c3_test_handler);
-    TEST_ASSERT(rc == 0);
-}
-
-TEST_CASE(config_test_save_3_fcb)
-{
-    int rc;
-    struct conf_fcb cf;
-    int i;
-
-    config_wipe_srcs();
-    config_wipe_fcb(fcb_areas, sizeof(fcb_areas) / sizeof(fcb_areas[0]));
-
-    cf.cf_fcb.f_sectors = fcb_areas;
-    cf.cf_fcb.f_sector_cnt = 4;
-
-    rc = conf_fcb_src(&cf);
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_fcb_dst(&cf);
-    TEST_ASSERT(rc == 0);
-
-    for (i = 0; i < 4096; i++) {
-        val32 = i;
-
-        rc = conf_save();
-        TEST_ASSERT(rc == 0);
-
-        val32 = 0;
-
-        rc = conf_load();
-        TEST_ASSERT(rc == 0);
-        TEST_ASSERT(val32 == i);
-    }
-}
-
-TEST_CASE(config_test_compress_reset)
-{
-    int rc;
-    struct conf_fcb cf;
-    struct flash_area *fa;
-    char test_value[64][CONF_MAX_VAL_LEN];
-    int elems[4];
-    int i;
-
-    config_wipe_srcs();
-    config_wipe_fcb(fcb_areas, sizeof(fcb_areas) / sizeof(fcb_areas[0]));
-
-    cf.cf_fcb.f_sectors = fcb_areas;
-    cf.cf_fcb.f_sector_cnt = sizeof(fcb_areas) / sizeof(fcb_areas[0]);
-
-    rc = conf_fcb_src(&cf);
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_fcb_dst(&cf);
-    TEST_ASSERT(rc == 0);
-
-    c2_var_count = 1;
-    memset(elems, 0, sizeof(elems));
-
-    for (i = 0; ; i++) {
-        config_test_fill_area(test_value, i);
-        memcpy(val_string, test_value, sizeof(val_string));
-
-        rc = conf_save();
-        TEST_ASSERT(rc == 0);
-
-        if (cf.cf_fcb.f_active.fe_area == &fcb_areas[2]) {
-            /*
-             * Started using space just before scratch.
-             */
-            break;
-        }
-        memset(val_string, 0, sizeof(val_string));
-
-        rc = conf_load();
-        TEST_ASSERT(rc == 0);
-        TEST_ASSERT(!memcmp(val_string, test_value, CONF_MAX_VAL_LEN));
-    }
-
-    fa = cf.cf_fcb.f_active.fe_area;
-    rc = fcb_append_to_scratch(&cf.cf_fcb);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(fcb_free_sector_cnt(&cf.cf_fcb) == 0);
-    TEST_ASSERT(fa != cf.cf_fcb.f_active.fe_area);
-
-    config_wipe_srcs();
-
-    memset(&cf, 0, sizeof(cf));
-
-    cf.cf_fcb.f_sectors = fcb_areas;
-    cf.cf_fcb.f_sector_cnt = sizeof(fcb_areas) / sizeof(fcb_areas[0]);
-
-    rc = conf_fcb_src(&cf);
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_fcb_dst(&cf);
-    TEST_ASSERT(rc == 0);
-
-    TEST_ASSERT(fcb_free_sector_cnt(&cf.cf_fcb) == 1);
-    TEST_ASSERT(fa == cf.cf_fcb.f_active.fe_area);
-
-    c2_var_count = 0;
-}
-
-TEST_CASE(config_test_save_one_fcb)
-{
-    int rc;
-    struct conf_fcb cf;
-
-    config_wipe_srcs();
-    config_wipe_fcb(fcb_areas, sizeof(fcb_areas) / sizeof(fcb_areas[0]));
-
-    cf.cf_fcb.f_sectors = fcb_areas;
-    cf.cf_fcb.f_sector_cnt = sizeof(fcb_areas) / sizeof(fcb_areas[0]);
-
-    rc = conf_fcb_src(&cf);
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_fcb_dst(&cf);
-    TEST_ASSERT(rc == 0);
-
-    val8 = 33;
-    rc = conf_save();
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_save_one("myfoo/mybar", "42");
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_load();
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(val8 == 42);
-
-    rc = conf_save_one("myfoo/mybar", "44");
-    TEST_ASSERT(rc == 0);
-
-    rc = conf_load();
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(val8 == 44);
-}
-
-TEST_SUITE(config_test_all)
-{
-    /*
-     * Config tests.
-     */
-    config_empty_lookups();
-    config_test_insert();
-    config_test_getset_unknown();
-    config_test_getset_int();
-    config_test_getset_bytes();
-
-    config_test_commit();
-
-    /*
-     * NFFS as backing storage.
-     */
-    config_setup_nffs();
-    config_test_empty_file();
-    config_test_small_file();
-    config_test_multiple_in_file();
-
-    config_test_save_in_file();
-
-    config_test_save_one_file();
-
-    /*
-     * FCB as backing storage.
-     */
-    config_test_empty_fcb();
-    config_test_save_1_fcb();
-
-    config_test_insert2();
-
-    config_test_save_2_fcb();
-
-    config_test_insert3();
-    config_test_save_3_fcb();
-
-    config_test_compress_reset();
-
-    config_test_save_one_fcb();
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/test/conf_test.h
----------------------------------------------------------------------
diff --git a/sys/config/src/test/conf_test.h b/sys/config/src/test/conf_test.h
deleted file mode 100644
index b50ff2f..0000000
--- a/sys/config/src/test/conf_test.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef _CONF_TEST_H_
-#define _CONF_TEST_H_
-
-void config_test_all(void);
-
-#endif /* _CONF_TEST_H_ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/test/conf_test_suite.c
----------------------------------------------------------------------
diff --git a/sys/config/src/test/conf_test_suite.c b/sys/config/src/test/conf_test_suite.c
deleted file mode 100644
index ef059cb..0000000
--- a/sys/config/src/test/conf_test_suite.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <os/os.h>
-#include <testutil/testutil.h>
-#include "config/config.h"
-#include "test/config_test.h"
-
-#ifdef MYNEWT_SELFTEST
-
-int
-main(int argc, char **argv)
-{
-    tu_config.tc_print_results = 1;
-    tu_init();
-
-    conf_init();
-    config_test_all();
-
-    return tu_any_failed;
-}
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/src/test/config_test.h
----------------------------------------------------------------------
diff --git a/sys/config/src/test/config_test.h b/sys/config/src/test/config_test.h
deleted file mode 100644
index da531af..0000000
--- a/sys/config/src/test/config_test.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#ifndef _CONFIG_TEST_H_
-#define _CONFIG_TEST_H_
-
-int config_test_all();
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/sys/config/test/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/config/test/pkg.yml b/sys/config/test/pkg.yml
new file mode 100644
index 0000000..7b533a6
--- /dev/null
+++ b/sys/config/test/pkg.yml
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+pkg.name: sys/config/test
+pkg.type: unittest
+pkg.description: "Config unit tests."
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+
+pkg.deps: 
+    - libs/testutil
+    - sys/config
+
+pkg.deps.SELFTEST:
+    - fs/nffs
+    - sys/fcb
+    - libs/console/stub