diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index c938dd0a24a..00000000000 --- a/Jenkinsfile +++ /dev/null @@ -1,2 +0,0 @@ -// This is internal file to run tests in internal Jenkins -mbed.run_job() diff --git a/TESTS/integration/COMMON/target_extended.json b/TESTS/integration/COMMON/target_extended.json index 78ef20196b6..11f4fe369b4 100644 --- a/TESTS/integration/COMMON/target_extended.json +++ b/TESTS/integration/COMMON/target_extended.json @@ -2,10 +2,10 @@ "target_overrides": { "NUCLEO_F412ZG": { "target.components_add" : ["SD", "WIFI_WIZFI310"], - "sd.SPI_MOSI" : "ARDUINO_UNO_SPI_MOSI", - "sd.SPI_MISO" : "ARDUINO_UNO_SPI_MISO", - "sd.SPI_CLK" : "ARDUINO_UNO_SPI_SCK", - "sd.SPI_CS" : "ARDUINO_UNO_SPI_CS", + "sd.spi-mosi" : "ARDUINO_UNO_SPI_MOSI", + "sd.spi-miso" : "ARDUINO_UNO_SPI_MISO", + "sd.spi-clk" : "ARDUINO_UNO_SPI_SCK", + "sd.spi-cs" : "ARDUINO_UNO_SPI_CS", "target.network-default-interface-type" : "WIFI", "wizfi310.tx" : "PD_5", "wizfi310.rx" : "PD_6", @@ -18,39 +18,39 @@ }, "NUCLEO_F429ZI": { "target.components_add" : ["SD"], - "sd.SPI_MOSI" : "PC_12", - "sd.SPI_MISO" : "PC_11", - "sd.SPI_CLK" : "PC_10", - "sd.SPI_CS" : "PC_9" + "sd.spi-mosi" : "PC_12", + "sd.spi-miso" : "PC_11", + "sd.spi-clk" : "PC_10", + "sd.spi-cs" : "PC_9" }, "NUCLEO_F767ZI": { "target.components_add" : ["SD"], - "sd.SPI_MOSI" : "PC_12", - "sd.SPI_MISO" : "PC_11", - "sd.SPI_CLK" : "PC_10", - "sd.SPI_CS" : "PC_9" + "sd.spi-mosi" : "PC_12", + "sd.spi-miso" : "PC_11", + "sd.spi-clk" : "PC_10", + "sd.spi-cs" : "PC_9" }, "NUCLEO_F746ZG": { "target.components_add" : ["SD"], - "sd.SPI_MOSI" : "PC_12", - "sd.SPI_MISO" : "PC_11", - "sd.SPI_CLK" : "PC_10", - "sd.SPI_CS" : "PC_9" + "sd.spi-mosi" : "PC_12", + "sd.spi-miso" : "PC_11", + "sd.spi-clk" : "PC_10", + "sd.spi-cs" : "PC_9" }, "NUCLEO_F207ZG": { "target.components_add" : ["SD"], - "sd.SPI_MOSI" : "PC_12", - "sd.SPI_MISO" : "PC_11", - "sd.SPI_CLK" : "PC_10", - "sd.SPI_CS" : "PC_9" + "sd.spi-mosi" : "PC_12", + "sd.spi-miso" : "PC_11", + "sd.spi-clk" : "PC_10", + "sd.spi-cs" : "PC_9" }, "NUCLEO_L476RG": { "target.macros_remove" : ["MBED_TICKLESS"], "target.components_add" : ["SD", "WIFI_WIZFI310"], - "sd.SPI_MOSI" : "ARDUINO_UNO_SPI_MOSI", - "sd.SPI_MISO" : "ARDUINO_UNO_SPI_MIS0", - "sd.SPI_CLK" : "ARDUINO_UNO_SPI_SCK", - "sd.SPI_CS" : "ARDUINO_UNO_SPI_CS", + "sd.spi-mosi" : "ARDUINO_UNO_SPI_MOSI", + "sd.spi-miso" : "ARDUINO_UNO_SPI_MIS0", + "sd.spi-clk" : "ARDUINO_UNO_SPI_SCK", + "sd.spi-cs" : "ARDUINO_UNO_SPI_CS", "target.network-default-interface-type" : "WIFI", "wizfi310.tx" : "ARDUINO_UNO_D8", "wizfi310.rx" : "ARDUINO_UNO_D2", @@ -65,10 +65,10 @@ "NUCLEO_L4R5ZI": { "target.macros_remove" : ["MBED_TICKLESS"], "target.components_add" : ["SD", "WIFI_WIZFI310"], - "sd.SPI_MOSI" : "ARDUINO_UNO_SPI_MOSI", - "sd.SPI_MISO" : "ARDUINO_UNO_SPI_MIS0", - "sd.SPI_CLK" : "ARDUINO_UNO_SPI_SCK", - "sd.SPI_CS" : "ARDUINO_UNO_SPI_CS", + "sd.spi-mosi" : "ARDUINO_UNO_SPI_MOSI", + "sd.spi-miso" : "ARDUINO_UNO_SPI_MIS0", + "sd.spi-clk" : "ARDUINO_UNO_SPI_SCK", + "sd.spi-cs" : "ARDUINO_UNO_SPI_CS", "target.network-default-interface-type" : "WIFI", "wizfi310.tx" : "ARDUINO_UNO_UART_TX", "wizfi310.rx" : "ARDUINO_UNO_UART_RX", @@ -82,10 +82,10 @@ "NUCLEO_L496ZG": { "target.macros_remove" : ["MBED_TICKLESS"], "target.components_add" : ["SD", "WIFI_WIZFI310"], - "sd.SPI_MOSI" : "ARDUINO_UNO_SPI_MOSI", - "sd.SPI_MISO" : "ARDUINO_UNO_SPI_MIS0", - "sd.SPI_CLK" : "ARDUINO_UNO_SPI_SCK", - "sd.SPI_CS" : "ARDUINO_UNO_SPI_CS", + "sd.spi-mosi" : "ARDUINO_UNO_SPI_MOSI", + "sd.spi-miso" : "ARDUINO_UNO_SPI_MIS0", + "sd.spi-clk" : "ARDUINO_UNO_SPI_SCK", + "sd.spi-cs" : "ARDUINO_UNO_SPI_CS", "target.network-default-interface-type" : "WIFI", "wizfi310.tx" : "ARDUINO_UNO_UART_TX", "wizfi310.rx" : "ARDUINO_UNO_UART_RX", @@ -151,10 +151,10 @@ }, "SDT64B": { "target.components_add" : ["SD"], - "sd.SPI_MOSI" : "PTB16", - "sd.SPI_MISO" : "PTB17", - "sd.SPI_CLK" : "PTB11", - "sd.SPI_CS" : "PTB10" + "sd.spi-mosi" : "PTB16", + "sd.spi-miso" : "PTB17", + "sd.spi-clk" : "PTB11", + "sd.spi-cs" : "PTB10" }, "GR_LYCHEE": { "target.components_add" : ["WIFI_ESP32"], @@ -165,22 +165,22 @@ }, "WIO_EMW3166": { "target.components_add" : ["SPIF"], - "spif-driver.SPI_MOSI" : "PB_15", - "spif-driver.SPI_MISO" : "PB_14", - "spif-driver.SPI_CLK" : "PB_13", - "spif-driver.SPI_CS" : "PA_10" + "spif-driver.spi-mosi" : "PB_15", + "spif-driver.spi-miso" : "PB_14", + "spif-driver.spi-clk" : "PB_13", + "spif-driver.spi-cs" : "PA_10" }, "EFM32GG11_STK3701": { "target.components_add" : ["QSPIF"], - "qspif.QSPI_FREQ" : 10000000 + "qspif.qspi-freq" : 10000000 }, "TB_SENSE_12": { "target.components_add" : ["SPIF"], - "spif-driver.SPI_MOSI" : "PK0", - "spif-driver.SPI_MISO" : "PK2", - "spif-driver.SPI_CLK" : "PF7", - "spif-driver.SPI_CS" : "PK1", - "spif-driver.SPI_FREQ" : 10000000, + "spif-driver.spi-mosi" : "PK0", + "spif-driver.spi-miso" : "PK2", + "spif-driver.spi-clk" : "PF7", + "spif-driver.spi-cs" : "PK1", + "spif-driver.spi-freq" : 10000000, "target.network-default-interface-type" : "MESH", "mbed-mesh-api.thread-config-channel" : 22, "mbed-mesh-api.thread-config-panid" : "0x0700", @@ -190,7 +190,7 @@ }, "ADV_WISE_1570": { "target.components_add" : ["SPIF"], - "spif-driver.SPI_FREQ" : 20000000, + "spif-driver.spi-freq" : 20000000, "target.network-default-interface-type" : "CELLULAR", "cellular.debug-at" : false, "cellular.use-apn-lookup" : false, diff --git a/connectivity/cellular/mbed_lib.json b/connectivity/cellular/mbed_lib.json index ed16d4a73a3..681ed8da06b 100644 --- a/connectivity/cellular/mbed_lib.json +++ b/connectivity/cellular/mbed_lib.json @@ -1,10 +1,6 @@ { "name": "cellular", "config": { - "present": { - "help": "MBED_CONF_CELLULAR_PRESENT will be defined if cellular is used", - "value": 1 - }, "use-apn-lookup": { "help": "Use APN database lookup", "value": false @@ -13,7 +9,7 @@ "help": "Enable or disable SMS functionality in Cellular stack.", "value": false }, - "random_max_start_delay": { + "random-max-start-delay": { "help": "Maximum random delay value used in start-up sequence in seconds", "value": 0 }, diff --git a/connectivity/drivers/802.15.4_RF/COMPONENT_MICROCHIP_AT86RF/mbed_lib.json b/connectivity/drivers/802.15.4_RF/COMPONENT_MICROCHIP_AT86RF/mbed_lib.json index 625ed90b86c..69553a42050 100644 --- a/connectivity/drivers/802.15.4_RF/COMPONENT_MICROCHIP_AT86RF/mbed_lib.json +++ b/connectivity/drivers/802.15.4_RF/COMPONENT_MICROCHIP_AT86RF/mbed_lib.json @@ -1,68 +1,68 @@ { "name": "atmel-rf", "config": { - "SPI_MOSI": { - "help": "SPI_MOSI pin configured for SPI connection.", + "spi-mosi": { + "help": "SPI MOSI pin configured for SPI connection.", "value": null }, - "SPI_MISO": { - "help": "SPI_MISO pin configured for SPI connection.", + "spi-miso": { + "help": "SPI MISO pin configured for SPI connection.", "value": null }, - "SPI_SCLK": { - "help": "SPI_SCLK pin configured for SPI connection.", + "spi-sclk": { + "help": "SPI SCLK pin configured for SPI connection.", "value": null }, - "SPI_CS": { - "help": "SPI_CS pin configured for SPI connection.", + "spi-cs": { + "help": "SPI CS pin configured for SPI connection.", "value": null }, - "SPI_RST": { - "help": "SPI_RST pin configured for SPI connection.", + "spi-rst": { + "help": "SPI RST pin configured for SPI connection.", "value": null }, - "SPI_SLP": { - "help": "SPI_SLP pin configured for SPI connection.", + "spi-slp": { + "help": "SPI SLP pin configured for SPI connection.", "value": null }, - "SPI_IRQ": { - "help": "SPI_IRQ pin configured for SPI connection.", + "spi-irq": { + "help": "SPI IRQ pin configured for SPI connection.", "value": null }, - "I2C_SDA": { - "help": "I2C_SDA pin configured for I2C connection.", + "i2c-sda": { + "help": "I2C SDA pin configured for I2C connection.", "value": null }, - "I2C_SCL": { - "help": "I2C_SCL pin configured for I2C connection.", + "i2c-scl": { + "help": "I2C SCL pin configured for I2C connection.", "value": null }, - "TEST_PIN_TX": { + "test-pin-tx": { "help": "TEST_PIN_TX pin configured for TX.", "value": null }, - "TEST_PIN_RX": { + "test-pin-rx": { "help": "TEST_PIN_RX pin configured for RX.", "value": null }, - "TEST_PIN_CSMA": { + "test-pin-csma": { "help": "TEST_PIN_CSMA pin configured for CSMA.", "value": null }, - "TEST_PIN_SPARE_1": { + "test-pin-spare-1": { "help": "TEST_PIN_SPARE_1.", "value": null }, - "TEST_PIN_SPARE_2": { + "test-pin-spare-2": { "help": "TEST_PIN_SPARE_2.", "value": null }, - "SE2435L_CSD": { - "help": "SE2435L_CSD pin configuration.", + "se2435l-csd": { + "help": "SE2435L CSD pin configuration.", "value": null }, - "SE2435L_ANT_SEL": { - "help": "SE2435L_ANT_SEL pin confuguration.", + "se2435l-ant-sel": { + "help": "SE2435L ANT_SEL pin confuguration.", "value": null }, "full-spi-speed": { diff --git a/connectivity/drivers/802.15.4_RF/COMPONENT_STM_S2_LP/mbed_lib.json b/connectivity/drivers/802.15.4_RF/COMPONENT_STM_S2_LP/mbed_lib.json index 55e4bf17484..ea5069cb953 100644 --- a/connectivity/drivers/802.15.4_RF/COMPONENT_STM_S2_LP/mbed_lib.json +++ b/connectivity/drivers/802.15.4_RF/COMPONENT_STM_S2_LP/mbed_lib.json @@ -1,68 +1,68 @@ { "name": "s2lp", "config": { - "SPI_SDI": { - "help": "SPI_SDI pin for SPI connection. D11 assumed, needs to be set/overwritten otherwise", + "spi-sdi": { + "help": "SPI SDI pin for SPI connection. D11 assumed, needs to be set/overwritten otherwise", "value": null }, - "SPI_SDO": { - "help": "SPI_SDO pin for SPI connection. D12 assumed, needs to be set/overwritten otherwise", + "spi-sdo": { + "help": "SPI SDO pin for SPI connection. D12 assumed, needs to be set/overwritten otherwise", "value": null }, - "SPI_SCLK": { - "help": "SPI_SCLK pin for SPI connection, D13 assumed, needs to be set/overwritten otherwise", + "spi-sclk": { + "help": "SPI SCLK pin for SPI connection, D13 assumed, needs to be set/overwritten otherwise", "value": null }, - "SPI_CS": { - "help": "SPI_CS pin for SPI connection, A1 assumed, needs to be set/overwritten otherwise", + "spi-cs": { + "help": "SPI CS pin for SPI connection, A1 assumed, needs to be set/overwritten otherwise", "value": null }, - "SPI_SDN": { - "help": "SPI_SDN pin for SPI connection, D7 assumed, needs to be set/overwritten otherwise", + "spi_sdn": { + "help": "SPI SDN pin for SPI connection, D7 assumed, needs to be set/overwritten otherwise", "value": null }, - "TEST_PIN_TX": { + "test-pin-tx": { "help": "TEST_PIN_TX pin for serial connection, D6 assumed, needs to be set/overwritten otherwise", "value": null }, - "TEST_PIN_RX": { + "test-pin-rx": { "help": "TEST_PIN_RX pin for serial connection, D5 assumed, needs to be set/overwritten otherwise", "value": null }, - "TEST_PIN_CSMA": { + "test-pin-csma": { "help": "TEST_PIN_CSMA pin for CSMA, D4 assumed, needs to be set/overwritten otherwise", "value": null }, - "TEST_PIN_SPARE_1": { + "test-pin-spare-1": { "help": "TEST_PIN_SPARE_1 pin for testing, D2 assumed, needs to be set/overwritten otherwise", "value": null }, - "TEST_PIN_SPARE_2": { + "stest-pin-spare-2": { "help": "TEST_PIN_SPARE_2 pin for testing, D8 assumed, needs to be set/overwritten otherwise", "value": null }, - "SPI_GPIO0": { - "help": "SPI_GPIO0 pin for GPIO testing, A0 assumed, needs to be set/overwritten otherwise", + "spi-gpio0": { + "help": "SPI GPIO0 pin for GPIO testing, A0 assumed, needs to be set/overwritten otherwise", "value": null }, - "SPI_GPIO1": { - "help": "SPI_GPIO1 pin for GPIO testing, A2 assumed, needs to be set/overwritten otherwise", + "spi-gpio1": { + "help": "SPI GPIO1 pin for GPIO testing, A2 assumed, needs to be set/overwritten otherwise", "value": null }, - "SPI_GPIO2": { - "help": "SPI_GPIO2 pin for GPIO testing, A3 assumed, needs to be set/overwritten otherwise", + "spi-gpio2": { + "help": "SPI GPIO2 pin for GPIO testing, A3 assumed, needs to be set/overwritten otherwise", "value": null }, - "SPI_GPIO3": { - "help": "SPI_GPIO3 pin for GPIO testing, A5 assumed, needs to be set/overwritten otherwise", + "spi-gpio3": { + "help": "SPI GPIO3 pin for GPIO testing, A5 assumed, needs to be set/overwritten otherwise", "value": null }, - "I2C_SDA": { - "help": "I2C_SDA pin for I2C SDA, null assumed, needs to be set/overwritten otherwise", + "i2c-sda": { + "help": "I2C SDA pin for I2C SDA, null assumed, needs to be set/overwritten otherwise", "value": null }, - "I2C_SCL": { - "help": "I2C_SCL pin for I2C SCL, null assumed, needs to be set/overwritten otherwise", + "i2c-scl": { + "help": "I2C SCL pin for I2C SCL, null assumed, needs to be set/overwritten otherwise", "value": null }, "provide-default": { diff --git a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_2/mbed_lib.json b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_2/mbed_lib.json index 502efc2aa04..5a5ed5937af 100644 --- a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_2/mbed_lib.json +++ b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_2/mbed_lib.json @@ -1,12 +1,12 @@ { "name": "bluenrg_2", "config": { - "SPI_MOSI": "D11", - "SPI_MISO": "D12", - "SPI_nCS": "A1", - "SPI_RESET": "D7", - "SPI_IRQ": "A0", - "SPI_SCK": "D3", + "spi-mosi": "D11", + "spi-miso": "D12", + "spi-ncs": "A1", + "spi-reset": "D7", + "spi-irq": "A0", + "spi-sck": "D3", "valid-public-bd-address": { "help": "Read the BD public address at startup", "value": false @@ -17,7 +17,7 @@ "target.macros_add": [ "CORDIO_RPA_SWAP_WORKAROUND=1" ] }, "NUCLEO_F446RE": { - "SPI_SCK": "D13" + "spi-sck": "D13" } } } diff --git a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_MS/mbed_lib.json b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_MS/mbed_lib.json index 75870974c23..1ceba44c6de 100644 --- a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_MS/mbed_lib.json +++ b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_MS/mbed_lib.json @@ -1,12 +1,12 @@ { "name": "bluenrg_ms", "config": { - "SPI_MOSI": "ARDUINO_UNO_SPI_MOSI", - "SPI_MISO": "ARDUINO_UNO_SPI_MISO", - "SPI_nCS": "ARDUINO_UNO_A1", - "SPI_RESET": "ARDUINO_UNO_D7", - "SPI_IRQ": "ARDUINO_UNO_A0", - "SPI_SCK": "ARDUINO_UNO_D3", + "spi-mosi": "ARDUINO_UNO_SPI_MOSI", + "spi-miso": "ARDUINO_UNO_SPI_MISO", + "spi-ncs": "ARDUINO_UNO_A1", + "spi-reset": "ARDUINO_UNO_D7", + "spi-irq": "ARDUINO_UNO_A0", + "spi-sck": "ARDUINO_UNO_D3", "valid-public-bd-address": { "help": "Read the BD public address at startup", "value": false @@ -14,39 +14,39 @@ }, "target_overrides": { "K64F": { - "SPI_SCK": "ARDUINO_UNO_SPI_SCK" + "spi-sck": "ARDUINO_UNO_SPI_SCK" }, "DISCO_L475VG_IOT01A": { - "SPI_MOSI": "PC_12", - "SPI_MISO": "PC_11", - "SPI_nCS": "PD_13", - "SPI_RESET": "PA_8", - "SPI_IRQ": "PE_6", - "SPI_SCK": "PC_10" + "spi-mosi": "PC_12", + "spi-miso": "PC_11", + "spi-ncs": "PD_13", + "spi-reset": "PA_8", + "spi-irq": "PE_6", + "spi-sck": "PC_10" }, "B_L4S5I_IOT01A": { - "SPI_MOSI": "PC_12", - "SPI_MISO": "PC_11", - "SPI_nCS": "PD_13", - "SPI_RESET": "PA_8", - "SPI_IRQ": "PE_6", - "SPI_SCK": "PC_10" + "spi-mosi": "PC_12", + "spi-miso": "PC_11", + "spi-ncs": "PD_13", + "spi-reset": "PA_8", + "spi-irq": "PE_6", + "spi-sck": "PC_10" }, "DISCO_L562QE": { - "SPI_MOSI": "PG_4", - "SPI_MISO": "PG_3", - "SPI_nCS": "PG_5", - "SPI_RESET": "PG_8", - "SPI_IRQ": "PG_6", - "SPI_SCK": "PG_2" + "spi-mosi": "PG_4", + "spi-miso": "PG_3", + "spi-ncs": "PG_5", + "spi-reset": "PG_8", + "spi-irq": "PG_6", + "spi-sck": "PG_2" }, "STWIN": { - "SPI_MOSI": "PC_3", - "SPI_MISO": "PD_3", - "SPI_nCS": "PG_5", - "SPI_RESET": "PA_8", - "SPI_IRQ": "PG_1", - "SPI_SCK": "PD_1" + "spi-mosi": "PC_3", + "spi-miso": "PD_3", + "spi-ncs": "PG_5", + "spi-reset": "PA_8", + "spi-irq": "PG_1", + "spi-sck": "PD_1" } } } diff --git a/connectivity/drivers/wifi/TARGET_STM/COMPONENT_EMW3080B/mbed_lib.json b/connectivity/drivers/wifi/TARGET_STM/COMPONENT_EMW3080B/mbed_lib.json index c6238780cd1..19c401ef9b9 100644 --- a/connectivity/drivers/wifi/TARGET_STM/COMPONENT_EMW3080B/mbed_lib.json +++ b/connectivity/drivers/wifi/TARGET_STM/COMPONENT_EMW3080B/mbed_lib.json @@ -10,7 +10,7 @@ "value": "NC" }, "wifi-mosi": { - "help": "SPI-MOSI connection to external device", + "help": "spi-mosi connection to external device", "value": "NC" }, "wifi-sclk": { diff --git a/connectivity/libraries/nanostack-libservice/mbed_lib.json b/connectivity/libraries/nanostack-libservice/mbed_lib.json index 910933b45e0..38145987407 100644 --- a/connectivity/libraries/nanostack-libservice/mbed_lib.json +++ b/connectivity/libraries/nanostack-libservice/mbed_lib.json @@ -2,7 +2,6 @@ "name": "nanostack-libservice", "macros": ["NSDYNMEM_TRACKER_ENABLED=MBED_CONF_NANOSTACK_LIBSERVICE_NSDYNMEM_TRACKER_ENABLED"], "config": { - "present": 1, "nsdynmem-tracker-enabled": { "help": "Use to enable dynamic memory tracker", "value": 0 diff --git a/connectivity/nanostack/nanostack-hal-mbed-cmsis-rtos/mbed_lib.json b/connectivity/nanostack/nanostack-hal-mbed-cmsis-rtos/mbed_lib.json index 12a4e1f8afc..a18ba0e93c5 100644 --- a/connectivity/nanostack/nanostack-hal-mbed-cmsis-rtos/mbed_lib.json +++ b/connectivity/nanostack/nanostack-hal-mbed-cmsis-rtos/mbed_lib.json @@ -1,7 +1,7 @@ { "name": "nanostack-hal", "config": { - "event_loop_thread_stack_size": { + "event-loop-thread-stack-size": { "help": "Define event-loop thread stack size. [bytes]", "value": 6144 }, diff --git a/connectivity/nanostack/sal-stack-nanostack-eventloop/mbed_lib.json b/connectivity/nanostack/sal-stack-nanostack-eventloop/mbed_lib.json index a56cdb50306..08309bc4a29 100644 --- a/connectivity/nanostack/sal-stack-nanostack-eventloop/mbed_lib.json +++ b/connectivity/nanostack/sal-stack-nanostack-eventloop/mbed_lib.json @@ -1,11 +1,11 @@ { "name": "nanostack-eventloop", "config": { - "use_platform_tick_timer": { + "use-platform-tick-timer": { "help": "Use platform provided low resolution tick timer for eventloop", "value": null }, - "exclude_highres_timer": { + "exclude-highres-timer": { "help": "Exclude high resolution timer from build", "value": null } diff --git a/connectivity/nanostack/sal-stack-nanostack/mbed_lib.json b/connectivity/nanostack/sal-stack-nanostack/mbed_lib.json index c397fa2075a..b724cd9e171 100644 --- a/connectivity/nanostack/sal-stack-nanostack/mbed_lib.json +++ b/connectivity/nanostack/sal-stack-nanostack/mbed_lib.json @@ -5,7 +5,7 @@ "help": "Build time configuration. Refer to Handbook for valid values. Default: full stack", "value": "nanostack_full" }, - "trace_max_level": { + "trace-max-level": { "help": "One of mbed-trace level defines: TRACE_LEVEL_DEBUG, TRACE_LEVEL_INFO, TRACE_LEVEL_WARN or TRACE_LEVEL_ERROR", "value": null } diff --git a/drivers/mbed_lib.json5 b/drivers/mbed_lib.json5 index a0c44cc0201..ecfd82e94f1 100644 --- a/drivers/mbed_lib.json5 +++ b/drivers/mbed_lib.json5 @@ -16,79 +16,79 @@ "help": "Number of entries in each of MbedCRC's pre-computed software tables. Higher values increase speed, but also increase image size. The value has no effect if the target performs the CRC in hardware. Permitted values are 0, 16 or 256.", "value": 16 }, - "spi_count_max": { + "spi-count-max": { "help": "The maximum number of SPI peripherals used at the same time. Determines RAM allocated for SPI peripheral management. If null, limit determined by hardware.", "value": null }, - "spi_transaction_queue_len": { + "spi-transaction-queue-len": { "help": "Size of the asynchronous transaction queue for each SPI peripheral on the processor. 0 means no queueing support. Only takes effect if the mbed target supports async SPI.", "value": 2 }, - "qspi_io0": { + "qspi-io0": { "help": "QSPI data I/O 0 pin", "value": "QSPI_FLASH1_IO0" }, - "qspi_io1": { + "qspi-io1": { "help": "QSPI data I/O 1 pin", "value": "QSPI_FLASH1_IO1" }, - "qspi_io2": { + "qspi-io2": { "help": "QSPI data I/O 2 pin", "value": "QSPI_FLASH1_IO2" }, - "qspi_io3": { + "qspi-io3": { "help": "QSPI data I/O 3 pin", "value": "QSPI_FLASH1_IO3" }, - "qspi_sck": { + "qspi-sck": { "help": "QSPI clock pin", "value": "QSPI_FLASH1_SCK" }, - "qspi_csn": { + "qspi-csn": { "help": "QSPI chip select pin", "value": "QSPI_FLASH1_CSN" }, - "ospi_io0": { + "ospi-io0": { "help": "OSPI data I/O 0 pin", "value": "OSPI_FLASH1_IO0" }, - "ospi_io1": { + "ospi-io1": { "help": "OSPI data I/O 1 pin", "value": "OSPI_FLASH1_IO1" }, - "ospi_io2": { + "ospi-io2": { "help": "OSPI data I/O 2 pin", "value": "OSPI_FLASH1_IO2" }, - "ospi_io3": { + "ospi-io3": { "help": "OSPI data I/O 3 pin", "value": "OSPI_FLASH1_IO3" }, - "ospi_io4": { + "ospi-io4": { "help": "OSPI data I/O 4 pin", "value": "OSPI_FLASH1_IO4" }, - "ospi_io5": { + "ospi-io5": { "help": "OSPI data I/O 5 pin", "value": "OSPI_FLASH1_IO5" }, - "ospi_io6": { + "ospi-io6": { "help": "OSPI data I/O 6 pin", "value": "OSPI_FLASH1_IO6" }, - "ospi_io7": { + "ospi-io7": { "help": "OSPI data I/O 7 pin", "value": "OSPI_FLASH1_IO7" }, - "ospi_sck": { + "ospi-sck": { "help": "OSPI clock pin", "value": "OSPI_FLASH1_SCK" }, - "ospi_csn": { + "ospi-csn": { "help": "OSPI chip select pin", "value": "OSPI_FLASH1_CSN" }, - "ospi_dqs": { + "ospi-dqs": { "help": "OSPI dqs pin", "value": "OSPI_FLASH1_DQS" } diff --git a/features/CMakeLists.txt b/features/CMakeLists.txt index eebc9509e49..994357fe07d 100644 --- a/features/CMakeLists.txt +++ b/features/CMakeLists.txt @@ -6,7 +6,6 @@ add_library(mbed-fpga-ci-test-shield INTERFACE) add_library(mbed-client-cli INTERFACE) add_subdirectory(frameworks/COMPONENT_FPGA_CI_TEST_SHIELD) -add_subdirectory(frameworks/mbed-client-cli) add_subdirectory(frameworks/cy_rtos_rtx_adapter) if(MBED_ENABLE_TESTING) diff --git a/features/frameworks/mbed-client-cli/CMakeLists.txt b/features/frameworks/mbed-client-cli/CMakeLists.txt deleted file mode 100644 index bb923d44476..00000000000 --- a/features/frameworks/mbed-client-cli/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -target_include_directories(mbed-client-cli - INTERFACE - . - ./mbed-client-cli -) - -target_sources(mbed-client-cli - INTERFACE - source/ns_cmdline.c -) - -target_link_libraries(mbed-client-cli - INTERFACE - mbed-nanostack-libservice -) diff --git a/features/frameworks/mbed-client-cli/mbed-client-cli/ns_cmdline.h b/features/frameworks/mbed-client-cli/mbed-client-cli/ns_cmdline.h deleted file mode 100644 index 772915b4e14..00000000000 --- a/features/frameworks/mbed-client-cli/mbed-client-cli/ns_cmdline.h +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (c) 2016 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed 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. - */ - -/** - * \file ns_cmdline.h - * - * Command line library - mbedOS shell - * - * Usage example: - * - * \code - * //simple print function - * void myprint(const char* fmt, va_list ap){ vprintf(fmt, ap); } - * // simple ready cb, which call next command to be execute - * void cmd_ready_cb(int retcode) { cmd_next( retcode ); } - * - * // dummy command with some option - * int cmd_dummy(int argc, char *argv[]){ - * if( cmd_has_option(argc, argv, "o") ) { - * cmd_printf("This is o option"); - * } else { - * return CMDLINE_RETCODE_INVALID_PARAMETERS; - * } - * return CMDLINE_RETCODE_SUCCESS; - *} - * // timer cb ( pseudo-timer-code ) - * void timer_ready_cb(void) { - * cmd_ready(CMDLINE_RETCODE_SUCCESS); - * } - * // long command, which need e.g. some events to finalize command execution - * int cmd_long(int argc, char *argv[] ) { - timer_start( 5000, timer_ready_cb ); - * return CMDLINE_RETCODE_EXCUTING_CONTINUE; - * } - * void main(void) { - * cmd_init( &myprint ); // initialize cmdline with print function - * cmd_set_ready_cb( cmd_ready_cb ); // configure ready cb - * cmd_add("dummy", cmd_dummy, 0, 0); // add one dummy command - * cmd_add("long", cmd_long, 0, 0); // add one dummy command - * //execute dummy and long commands - * cmd_exe( "dymmy;long" ); - * } - * \endcode - */ -#ifndef _CMDLINE_H_ -#define _CMDLINE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -#define CMDLINE_RETCODE_COMMAND_BUSY 2 //!< Command Busy -#define CMDLINE_RETCODE_EXCUTING_CONTINUE 1 //!< Execution continue in background -#define CMDLINE_RETCODE_SUCCESS 0 //!< Execution Success -#define CMDLINE_RETCODE_FAIL -1 //!< Execution Fail -#define CMDLINE_RETCODE_INVALID_PARAMETERS -2 //!< Command parameters was incorrect -#define CMDLINE_RETCODE_COMMAND_NOT_IMPLEMENTED -3 //!< Command not implemented -#define CMDLINE_RETCODE_COMMAND_CB_MISSING -4 //!< Command callback function missing -#define CMDLINE_RETCODE_COMMAND_NOT_FOUND -5 //!< Command not found - -/** - * typedef for print functions - */ -typedef void (cmd_print_t)(const char *, va_list); -/** - * Initialize cmdline class. - * This is command line editor without any commands. Application - * needs to add commands that should be enabled. - * usage e.g. - * \code - cmd_init( &default_cmd_response_out ); - * \endcode - * \param outf console printing function (like vprintf) - */ -void cmd_init(cmd_print_t *outf); -/** Command ready function for __special__ cases. - * This need to be call if command implementation return CMDLINE_RETCODE_EXECUTING_CONTINUE - * because there is some background stuff ongoing before command is finally completed. - * Normally there is some event, which call cmd_ready(). - * \param retcode return code for command - */ -void cmd_ready(int retcode); -/** typedef for ready cb function */ -typedef void (cmd_ready_cb_f)(int); -/** - * Configure cb which will be called after commands are executed - * or cmd_ready is called - * \param cb callback function for command ready - */ -void cmd_set_ready_cb(cmd_ready_cb_f *cb); -/** - * execute next command if any - * \param retcode last command return value - */ -void cmd_next(int retcode); -/** Free cmd class */ -void cmd_free(void); -/** Reset cmdline to default values - * detach external commands, delete all variables and aliases - */ -void cmd_reset(void); -/** Configure command history size (default 32) - * \param max maximum history size - * max > 0 -> configure new value - * max = 0 -> just return current value - * \return current history max-size - */ -uint8_t cmd_history_size(uint8_t max); -/** command line print function - * This function should be used when user want to print something to the console - * \param fmt console print function (like printf) - */ -#if defined(__GNUC__) -void cmd_printf(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2))); -#else -void cmd_printf(const char *fmt, ...); -#endif -/** command line print function - * This function should be used when user want to print something to the console with vprintf functionality - * \param fmt The format string is a character string, beginning and ending in its initial shift state, if any. The format string is composed of zero or more directives. - * \param ap list of parameters needed by format string. This must correspond properly with the conversion specifier. - */ -#if defined(__GNUC__) -void cmd_vprintf(const char *fmt, va_list ap) __attribute__((__format__(__printf__, 1, 0))); -#else -void cmd_vprintf(const char *fmt, va_list ap); -#endif -/** Reconfigure default cmdline out function (cmd_printf) - * \param outf select console print function - */ -void cmd_out_func(cmd_print_t *outf); -/** Configure function, which will be called when Ctrl+A is pressed - * \param sohf control function which called every time when user input control keys - */ -void cmd_ctrl_func(void (*sohf)(uint8_t c)); -/** - * Configure mutex wait function - * By default, cmd_printf calls may not be thread safe, depending on the implementation of the used output. - * This can be used to set a callback function that will be called before each cmd_printf call. - * The specific implementation is up to the application developer, but simple mutex locking is assumed. - */ -void cmd_mutex_wait_func(void (*mutex_wait_f)(void)); -/** - * Configure mutex wait function - * By default, cmd_printf calls may not be thread safe, depending on the implementation of the used output. - * This can be used to set a callback function that will be called after each cmd_printf call. - * The specific implementation is up to the application developer, but simple mutex locking is assumed. - */ -void cmd_mutex_release_func(void (*mutex_release_f)(void)); -/** - * Retrieve output mutex lock - * This can be used to retrieve the output mutex when multiple cmd_printf/cmd_vprintf calls must be - * guaranteed to be grouped together in a thread safe manner. Must be released by a following call to - * cmd_mutex_unlock() - * For example: - * * \code - * cmd_mutex_lock(); - for (i = 0; i < 10; i++) { - cmd_printf("%02x ", i); - } - // without locking a print from another thread could happen here - cmd_printf("\r\n); - cmd_mutex_unlock(); - * \endcode - * Exact behaviour depends on the implementation of the configured mutex, - * but counting mutexes are required. - */ -void cmd_mutex_lock(void); -/** - * Release output mutex lock - * This can be used to release the output mutex once it has been retrieved with cmd_mutex_lock() - * Exact behaviour depends on the implementation of the configured mutex, - * but counting mutexes are required. - */ -void cmd_mutex_unlock(void); -/** Refresh output */ -void cmd_output(void); -/** default cmd response function, use stdout - * \param fmt The format string is a character string, beginning and ending in its initial shift state, if any. The format string is composed of zero or more directives. - * \param ap list of parameters needed by format string. This must correspond properly with the conversion specifier. - */ -void default_cmd_response_out(const char *fmt, va_list ap); -/** Initialize screen */ -void cmd_init_screen(void); -/** Get echo state - * \return true if echo is on otherwise false - */ -bool cmd_echo_state(void); -/** Echo off */ -void cmd_echo_off(void); -/** Echo on */ -void cmd_echo_on(void); -/** Enter character to console. - * insert key pressess to cmdline called from main loop of application - * \param u_data char to be added to console - */ -void cmd_char_input(int16_t u_data); -/* - * Set the passthrough mode callback function. In passthrough mode normal command input handling is skipped and any - * received characters are passed to the passthrough callback function. Setting this to null will disable passthrough mode. - * \param passthrough_fnc The passthrough callback function - */ -typedef void (*input_passthrough_func_t)(uint8_t c); -void cmd_input_passthrough_func(input_passthrough_func_t passthrough_fnc); - -/* Methods used for adding and handling of commands and aliases - */ - -/** Callback called when your command is run. - * \param argc argc is the count of arguments given in argv pointer list. value begins from 1 and this means that the 0 item in list argv is a string to name of command. - * \param argv argv is list of arguments. List size is given in argc parameter. Value in argv[0] is string to name of command. - */ -typedef int (cmd_run_cb)(int argc, char *argv[]); -/** Add command to intepreter - * \param name command string - * \param callback This function is called when command line start executing - * \param info Command short description which is visible in help command, or null if not in use - * \param man Help page for this command. This is shown when executing command with invalid parameters or command with --help parameter. Can be null if not in use. - */ -void cmd_add(const char *name, cmd_run_cb *callback, const char *info, const char *man); - -/** delete command from intepreter - * \param name command to be delete - */ -void cmd_delete(const char *name); -/** Command executer. - * Command executer, which split&push command(s) to the buffer and - * start executing commands in cmd tasklet. - * if not, execute command directly. - * If command implementation returns CMDLINE_RETCODE_EXCUTING_CONTINUE, - * executor will wait for cmd_ready() before continue to next command. - * \param str command string, e.g. "help" - */ -void cmd_exe(char *str); -/** Add alias to interpreter. - * Aliases are replaced with values before executing a command. All aliases must be started from beginning of line. - * null or empty value deletes alias. - * \code - cmd_alias_add("print", "echo"); - cmd_exe("print \"hello world!\""); // this is now same as "echo \"hello world!\"" . - * \endcode - * \param alias alias name - * \param value value for alias. Values can be any visible ASCII -characters. - */ -void cmd_alias_add(const char *alias, const char *value); -/** Add Variable to interpreter. - * Variables are replaced with values before executing a command. - * To use variables from cli, use dollar ($) -character so that interpreter knows user want to use variable in that place. - * null or empty value deletes variable. - * \code - cmd_variable_add("world", "hello world!"); - cmd_exe("echo $world"); // this is now same as echo "hello world!" . - * \endcode - * \param variable Variable name, which will be replaced in interpreter. - * \param value Value for variable. Values can contains white spaces and '"' or '"' characters. - */ -void cmd_variable_add(char *variable, char *value); -/** - * Add integer variable to interpreter. - * Variables are replaced with values before executing a command. - * \code - cmd_variable_add_int("world", 2); - cmd_exe("echo $world"); // this is now same as 'echo 2' . - * \endcode - * \param variable Variable name, which will be replaced in interpreter. - * \param value Value for variable - - */ -void cmd_variable_add_int(char *variable, int value); -/** - * Request screen size from host - * Response are stored to variables: - * COLUMNS and LINES - as integer values. - * Note: Require terminal that handle request codes, like screen. - */ -void cmd_request_screen_size(void); - -/** find command parameter index by key. - * e.g. - * \code - int main(void){ - //..init cmd.. - //.. - cmd_exe("mycmd enable") - } - int mycmd_command(int argc, char *argv[]) { - bool found = cmd_parameter_index( argc, argv, "enable" ) > 0; - } - * \endcode - * \param argc argc is the count of arguments given in argv pointer list. value begins from 1 and this means that the 0 item in list argv is a string to name of command. - * \param argv is list of arguments. List size is given in argc parameter. Value in argv[0] is string to name of command. - * \param key option key, which index you want to find out. - * \return index where parameter was or -1 when not found - */ -int cmd_parameter_index(int argc, char *argv[], const char *key); -/** check if command option is present. - * e.g. cmd: "mycmd -c" - * \code - * bool on = cmd_has_option( argc, argv, "p" ); - * \endcode - * \param argc argc is the count of arguments given in argv pointer list. value begins from 1 and this means that the 0 item in list argv is a string to name of command. - * \param argv is list of arguments. List size is given in argc parameter. Value in argv[0] is string to name of command. - * \param key option key to be find - * \return true if option found otherwise false - */ -bool cmd_has_option(int argc, char *argv[], const char *key); -/** find command parameter by key. - * if exists, return true, otherwise false. - * e.g. cmd: "mycmd enable 1" - * \code - int mycmd_command(int argc, char *argv[]) { - bool value; - bool found = cmd_parameter_bool( argc, argv, "mykey", &value ); - if( found ) return CMDLINE_RETCODE_SUCCESS; - else return CMDLINE_RETCODE_FAIL; - } - * \endcode - * \param argc argc is the count of arguments given in argv pointer list. value begins from 1 and this means that the 0 item in list argv is a string to name of command. - * \param argv is list of arguments. List size is given in argc parameter. Value in argv[0] is string to name of command. - * \param key parameter key to be find - * \param value parameter value to be fetch, if key not found value are untouched. "1" and "on" and "true" and "enable" and "allow" are True -value, all others false. - * \return true if parameter key and value found otherwise false - */ -bool cmd_parameter_bool(int argc, char *argv[], const char *key, bool *value); -/** find command parameter by key and return value (next parameter). - * if exists, return parameter pointer, otherwise null. - * e.g. cmd: "mycmd mykey myvalue" - * \code - int mycmd_command(int argc, char *argv[]) { - char *value; - bool found = cmd_parameter_val( argc, argv, "mykey", &value ); - if( found ) return CMDLINE_RETCODE_SUCCESS; - else return CMDLINE_RETCODE_FAIL; - } - * \endcode - * \param argc argc is the count of arguments given in argv pointer list. value begins from 1 and this means that the 0 item in list argv is a string to name of command. - * \param argv is list of arguments. List size is given in argc parameter. Value in argv[0] is string to name of command. - * \param key parameter key to be find - * \param value pointer to pointer, which will point to cli input data when key and value found. if key or value not found this parameter are untouched. - * \return true if parameter key and value found otherwise false - */ -bool cmd_parameter_val(int argc, char *argv[], const char *key, char **value); -/** find command parameter by key and return value (next parameter) in integer. Only whitespaces are allowed in addition to the float to be read. - * e.g. cmd: "mycmd mykey myvalue" - * \code - int32_t value; - cmd_parameter_int( argc, argv, "key", &value ); - * \endcode - * \param argc argc is the count of arguments given in argv pointer list. value begins from 1 and this means that the item 0 in the list argv is a string to name of command. - * \param argv is list of arguments. List size is given in argc parameter. Value in argv[0] is string to name of command. - * \param key parameter key to be found - * \param value A pointer to a variable where to write the converted number. If value cannot be converted, it is not touched. - * \return true if parameter key and an integer is found, otherwise return false - */ -bool cmd_parameter_int(int argc, char *argv[], const char *key, int32_t *value); -/** find command parameter by key and return value (next parameter) in float. Only whitespaces are allowed in addition to the float to be read. - * e.g. cmd: "mycmd mykey myvalue" - * \code - float value; - cmd_parameter_float( argc, argv, "key", &value ); - * \endcode - * \param argc argc is the count of arguments given in argv pointer list. values begin from 1 and this means that the item 0 in the list argv is a string to name of command. - * \param argv is list of arguments. List size is given in argc parameter. Value in argv[0] is string to name of command. - * \param key parameter key to be found - * \param value A pointer to a variable where to write the converted number. If value cannot be converted, it is not touched. - * \return true if parameter key and a float found, otherwise return false - */ -bool cmd_parameter_float(int argc, char *argv[], const char *key, float *value); -/** Get last command line parameter as string. - * e.g. - * cmd: "mycmd hello world" - * cmd_parameter_last -> "world" - * cmd: "mycmd" - * cmd_parameter_last() -> NULL - * \code - cmd_parameter_last(argc, argv) - * \endcode - * \param argc argc is the count of arguments given in argv pointer list. value begins from 1 and this means that the 0 item in list argv is a string to name of command. - * \param argv is list of arguments. List size is given in argc parameter. Value in argv[0] is string to name of command. - * \return pointer to last parameter or NULL when there is no any parameters. - */ -char *cmd_parameter_last(int argc, char *argv[]); - -/** find command parameter by key and return value (next parameter) in int64. - * e.g. cmd: "mycmd mykey myvalue" - * \code - uint32_t i; - cmd_parameter_timestamp( argc, argv, "mykey", &i ); - * \endcode - * - * Supports following formats: - * number -> direct conversion - * 11:22:33:44:55:66:77:88 -> converts to number - * seconds,tics -> converts thread type timestamp to int64 - * - * \param argc argc is the count of arguments given in argv pointer list. value begins from 1 and this means that the 0 item in list argv is a string to name of command. - * \param argv is list of arguments. List size is given in argc parameter. Value in argv[0] is string to name of command. - * \param key parameter key to be find - * \param value parameter value to be fetch, if key not found value are untouched. - * \return true if parameter key and value found otherwise false - */ -bool cmd_parameter_timestamp(int argc, char *argv[], const char *key, int64_t *value); - -#ifdef __cplusplus -} -#endif -#endif /*_CMDLINE_H_*/ diff --git a/features/frameworks/mbed-client-cli/mbed_lib.json b/features/frameworks/mbed-client-cli/mbed_lib.json deleted file mode 100644 index 17cdcf76568..00000000000 --- a/features/frameworks/mbed-client-cli/mbed_lib.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "cmdline", - "config": { - "use_minimum_set": { - "help": "use pre configured minimum set which reduce most of features but allows to run icetea tests. Defaults to 'false' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "enable_aliases": { - "help": "enable alias feature. Defaults to 'true' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "enable_escape_handling": { - "help": "enable escape handling. Defaults to 'true' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "enable_operators": { - "help": "enable operators. Defaults to 'true' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "enable_internal_commands": { - "help": "enable internal commands, like echo, set, unset. Defaults to 'true' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "use_dummy_set_and_echo": { - "help": "when enable_internal_commands is disabled this can be used to activate dummy set and echo commands that is needed for icetea tests. Defaults to 'false' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "enable_internal_variables": { - "help": "enable internal variables. Defaults to 'true' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "include_man": { - "help": "include man pages. Defaults to 'true' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "max_line_length": { - "help": "maximum input line length. Defaults to 2000 when not set", - "value": null - }, - "args_max_count": { - "help": "maximum arguments count. Defaults to 30 when not set", - "value": null - }, - "enable_history": { - "help": "enable command history. Defaults to 'true' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "history_max_count": { - "help": "maximum history count. Defaults to 32 when not set", - "value": null - }, - "boot_message": { - "help": "Set custom boot message when calling cmd_init() or cmd_init_screen()", - "value": null - }, - "enable_internal_traces": { - "help": "Enable internal traces. Defaults to 'false' when not set", - "accepted_values": [true, false, null], - "value": null - }, - "enable_deep_internal_traces": { - "help": "Enable more verbose internal traces. Defaults to 'false' when not set", - "accepted_values": [true, false, null], - "value": null - } - } -} diff --git a/features/frameworks/mbed-client-cli/source/ns_cmdline.c b/features/frameworks/mbed-client-cli/source/ns_cmdline.c deleted file mode 100644 index 7e113502b63..00000000000 --- a/features/frameworks/mbed-client-cli/source/ns_cmdline.c +++ /dev/null @@ -1,2483 +0,0 @@ -/* - * Copyright (c) 2016 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed 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 -#include -#include -#include -#include - -#if defined(_WIN32) || defined(__unix__) || defined(__unix) || defined(unix) || defined(MBED_CONF_RTOS_PRESENT) || defined(__APPLE__) -#include //malloc -#ifndef MEM_ALLOC -#define MEM_ALLOC malloc -#endif -#ifndef MEM_FREE -#define MEM_FREE free -#endif -#else -#include "nsdynmemLIB.h" -#ifndef MEM_ALLOC -#define MEM_ALLOC ns_dyn_mem_temporary_alloc -#endif -#ifndef MEM_FREE -#define MEM_FREE ns_dyn_mem_free -#endif -#endif - - -// available configurations -//#define MBED_CONF_CMDLINE_USE_MINIMUM_SET 0 -//#define MBED_CONF_CMDLINE_ENABLE_ALIASES 0 -//#define MBED_CONF_CMDLINE_USE_DUMMY_SET_ECHO_COMMANDS 1 -//#define MBED_CONF_CMDLINE_INIT_AUTOMATION_MODE 0 -//#define MBED_CONF_CMDLINE_ENABLE_HISTORY 0 -//#define MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING 0 -//#define MBED_CONF_CMDLINE_ENABLE_OPERATORS 0 -//#define MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS 0 -//#define MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES 0 -//#define MBED_CONF_CMDLINE_INCLUDE_MAN 0 -//#define MBED_CONF_CMDLINE_MAX_LINE_LENGTH 100 -//#define MBED_CONF_CMDLINE_ARGS_MAX_COUNT 2 -//#define MBED_CONF_CMDLINE_HISTORY_MAX_COUNT 1 -//#define MBED_CONF_CMDLINE_BOOT_MESSAGE "hello there\n" -//#define MBED_CONF_CMDLINE_ENABLE_INTERNAL_TRACES 1 -//#define MBED_CONF_CMDLINE_ENABLE_DEEP_INTERNAL_TRACES 1 - - - -// ------------------------ -// backward compatible -#if defined(MBED_CMDLINE_MAX_LINE_LENGTH) && !defined(MBED_CONF_CMDLINE_MAX_LINE_LENGTH) -#define MBED_CONF_CMDLINE_MAX_LINE_LENGTH MBED_CMDLINE_MAX_LINE_LENGTH -#endif -#if defined(MBED_CMDLINE_ARGUMENTS_MAX_COUNT) && !defined(MBED_CONF_CMDLINE_ARGS_MAX_COUNT) -#define MBED_CONF_CMDLINE_ARGS_MAX_COUNT MBED_CMDLINE_ARGUMENTS_MAX_COUNT -#endif -#if defined(MBED_CMDLINE_HISTORY_MAX_COUNT) && !defined(MBED_CONF_CMDLINE_HISTORY_MAX_COUNT) -#define MBED_CONF_CMDLINE_HISTORY_MAX_COUNT MBED_CMDLINE_HISTORY_MAX_COUNT -#endif -#if defined(MBED_CMDLINE_INCLUDE_MAN) && !defined(MBED_CONF_CMDLINE_INCLUDE_MAN) -#define MBED_CONF_CMDLINE_INCLUDE_MAN MBED_CMDLINE_INCLUDE_MAN -#endif -#if defined(MBED_CLIENT_CLI_TRACE_ENABLE) && !defined(MBED_CONF_CMDLINE_ENABLE_INTERNAL_TRACES) -#define MBED_CONF_CMDLINE_ENABLE_INTERNAL_TRACES MBED_CLIENT_CLI_TRACE_ENABLE -#endif -#if defined(MBED_CMDLINE_BOOT_MESSAGE) && !defined(MBED_CONF_CMDLINE_BOOT_MESSAGE) -#define MBED_CONF_CMDLINE_BOOT_MESSAGE MBED_CMDLINE_BOOT_MESSAGE -#endif -// ------------------------ - -#ifndef MBED_CONF_CMDLINE_USE_MINIMUM_SET -#define MBED_CONF_CMDLINE_USE_MINIMUM_SET 0 -#endif - -#if MBED_CONF_CMDLINE_USE_MINIMUM_SET == 1 -// configure default minimum values, each value can be overwrite by compiling time -#ifndef MBED_CONF_CMDLINE_ENABLE_ALIASES -#define MBED_CONF_CMDLINE_ENABLE_ALIASES 0 -#endif -#ifndef MBED_CONF_CMDLINE_USE_DUMMY_SET_ECHO_COMMANDS -#define MBED_CONF_CMDLINE_USE_DUMMY_SET_ECHO_COMMANDS 1 -#endif -#ifndef MBED_CONF_CMDLINE_INIT_AUTOMATION_MODE -#define MBED_CONF_CMDLINE_INIT_AUTOMATION_MODE 1 -#endif -#ifndef MBED_CONF_CMDLINE_ENABLE_HISTORY -#define MBED_CONF_CMDLINE_ENABLE_HISTORY 0 -#endif -#ifndef MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING -#define MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING 0 -#endif -#ifndef MBED_CONF_CMDLINE_ENABLE_OPERATORS -#define MBED_CONF_CMDLINE_ENABLE_OPERATORS 0 -#endif -#ifndef MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS -#define MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS 0 -#endif -#ifndef MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES -#define MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES 0 -#endif -#ifndef MBED_CONF_CMDLINE_INCLUDE_MAN -#define MBED_CONF_CMDLINE_INCLUDE_MAN 0 -#endif -#ifndef MBED_CONF_CMDLINE_MAX_LINE_LENGTH -#define MBED_CONF_CMDLINE_MAX_LINE_LENGTH 100 -#endif -#ifndef MBED_CONF_CMDLINE_ARGS_MAX_COUNT -#define MBED_CONF_CMDLINE_ARGS_MAX_COUNT 10 -#endif -#ifndef MBED_CONF_CMDLINE_HISTORY_MAX_COUNT -#define MBED_CONF_CMDLINE_HISTORY_MAX_COUNT 0 -#endif -// end of default configurations -#endif - -#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) -#define CMDLINE_UNUSED __attribute__((unused)) -#else -#define CMDLINE_UNUSED -#endif - -#ifdef YOTTA_CFG -#include "ns_list_internal/ns_list.h" -#include "mbed-client-cli/ns_cmdline.h" -#else -#include "ns_list.h" -#include "ns_cmdline.h" -#endif -#include "mbed-trace/mbed_trace.h" - -//#define TRACE_PRINTF - -#ifdef TRACE_PRINTF -#undef tr_debug -#define tr_debug(...) printf( __VA_ARGS__);printf("\r\n") -#endif - -// #define MBED_CONF_CMDLINE_ENABLE_INTERNAL_TRACES 1 -// MBED_CONF_CMDLINE_ENABLE_INTERNAL_TRACES is to enable the traces for debugging, -// By default all debug traces are disabled. -#if !defined(MBED_CONF_CMDLINE_ENABLE_INTERNAL_TRACES) || MBED_CONF_CMDLINE_ENABLE_INTERNAL_TRACES == 0 -#undef tr_error -#define tr_error(...) -#undef tr_warn -#define tr_warn(...) -#undef tr_debug -#define tr_debug(...) -#undef tr_info -#define tr_info(...) -#endif - -#ifdef MBED_CONF_CMDLINE_ENABLE_DEEP_INTERNAL_TRACES -#define tr_deep tr_debug -#else -#define tr_deep(...) -#endif - -#define TRACE_GROUP "cmdL" - -#ifndef MBED_CONF_CMDLINE_BOOT_MESSAGE -#define MBED_CONF_CMDLINE_BOOT_MESSAGE "ARM Ltd\r\n" -#endif -#define ESCAPE(x) "\x1b" x -#define CR_S "\r" -#define LF_S "\n" -#define CLEAR_ENTIRE_LINE ESCAPE("[2K") -#define CLEAR_ENTIRE_SCREEN ESCAPE("[2J") -#define ENABLE_AUTO_WRAP_MODE ESCAPE("[7h") -#define MOVE_CURSOR_LEFT_N_CHAR ESCAPE("[%dD") - -#define SET_TOP_AND_BOTTOM_LINES ESCAPE("[;r") -#define MOVE_CURSOR_TO_BOTTOM_RIGHT ESCAPE("[999;999H") -#define STORE_CURSOR_POS ESCAPE("7") -#define RESTORE_CURSOR_POS ESCAPE("8") -#define GET_CURSOR_POSITION ESCAPE("[6n") - -#define REQUEST_SCREEN_SIZE STORE_CURSOR_POS SET_TOP_AND_BOTTOM_LINES MOVE_CURSOR_TO_BOTTOM_RIGHT GET_CURSOR_POSITION RESTORE_CURSOR_POS - -/*ASCII defines*/ -#define ESC 0x1B -#define DEL 0x7F -#define BS 0x08 -#define ETX 0x03 -#define ETB 0x17 -#define TAB 0x09 -#define CAN 0x18 - -#define DEFAULT_RETFMT "retcode: %i\r\n" -#define DEFAULT_PROMPT "/>" -#define VAR_PROMPT "PS1" -#define VAR_RETFMT "RETFMT" -#define MBED_CMDLINE_ESCAPE_BUFFER_SIZE 10 - -// by default use -#ifndef MBED_CONF_CMDLINE_ENABLE_ALIASES -#define MBED_CONF_CMDLINE_ENABLE_ALIASES 1 -#endif -#ifndef MBED_CONF_CMDLINE_USE_DUMMY_SET_ECHO_COMMANDS -#define MBED_CONF_CMDLINE_USE_DUMMY_SET_ECHO_COMMANDS 0 -#elif defined(MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS) && MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 1 && MBED_CONF_CMDLINE_USE_DUMMY_SET_ECHO_COMMANDS == 1 -#warning "Cannot set MBED_CONF_CMDLINE_USE_DUMMY_SET_ECHO_COMMANDS along with MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS" -#endif -// Maximum length of input line -#ifndef MBED_CONF_CMDLINE_MAX_LINE_LENGTH -#define MBED_CONF_CMDLINE_MAX_LINE_LENGTH 2000 -#endif -// Maximum number of arguments in a single command -#ifndef MBED_CONF_CMDLINE_ARGS_MAX_COUNT -#define MBED_CONF_CMDLINE_ARGS_MAX_COUNT 30 -#endif -// initialize automation mode at startup phase, no need to send set -commands -#ifndef MBED_CONF_CMDLINE_INIT_AUTOMATION_MODE -#define MBED_CONF_CMDLINE_INIT_AUTOMATION_MODE 0 -#endif -// include manuals or not (save memory a little when not include) -#ifndef MBED_CONF_CMDLINE_INCLUDE_MAN -#define MBED_CONF_CMDLINE_INCLUDE_MAN 1 -#endif -// allow to browse history using up/down keys (require ESCAPE_HANDLING) -#ifndef MBED_CONF_CMDLINE_ENABLE_HISTORY -#define MBED_CONF_CMDLINE_ENABLE_HISTORY 1 -#endif -// Maximum number of commands saved in history -#ifndef MBED_CONF_CMDLINE_HISTORY_MAX_COUNT -#define MBED_CONF_CMDLINE_HISTORY_MAX_COUNT 32 -#endif -// handle escape characters -#ifndef MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING -#define MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING 1 -#endif -// enable all internal commands -#ifndef MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS -#define MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS 1 -#endif -// enable internal variables -#ifndef MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES -#define MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES 1 -#endif -// enable operators -#ifndef MBED_CONF_CMDLINE_ENABLE_OPERATORS -#define MBED_CONF_CMDLINE_ENABLE_OPERATORS 1 -#endif - - -typedef struct cmd_history_s { - char *command_ptr; - ns_list_link_t link; -} cmd_history_t; -typedef NS_LIST_HEAD(cmd_history_t, link) history_list_t; - -typedef struct cmd_command_s { - const char *name_ptr; - const char *info_ptr; - const char *man_ptr; - cmd_run_cb *run_cb; - bool busy; - ns_list_link_t link; -} cmd_command_t; -typedef NS_LIST_HEAD(cmd_command_t, link) command_list_t; - -typedef struct cmd_alias_s { - char *name_ptr; - char *value_ptr; - ns_list_link_t link; -} cmd_alias_t; -typedef NS_LIST_HEAD(cmd_alias_t, link) alias_list_t; - -union Data { - char *ptr; - int i; -}; -typedef enum value_type_s { - VALUE_TYPE_STR, - VALUE_TYPE_INT -} value_type_t; - -typedef struct cmd_variable_s { - char *name_ptr; - union Data value; - value_type_t type; - ns_list_link_t link; -} cmd_variable_t; -typedef NS_LIST_HEAD(cmd_variable_t, link) variable_list_t; - -typedef enum operator_s { - OPERATOR_SEMI_COLON, //default - OPERATOR_AND, - OPERATOR_OR, - OPERATOR_BACKGROUND, - OPERATOR_PIPE -} operator_t; - -typedef struct cmd_exe_s { - char *cmd_s; - operator_t operator; - ns_list_link_t link; -} cmd_exe_t; -typedef NS_LIST_HEAD(cmd_exe_t, link) cmd_list_t; - - -typedef struct cmd_class_s { - char input[MBED_CONF_CMDLINE_MAX_LINE_LENGTH]; // input data - -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - int16_t history; // history position - history_list_t history_list; // input history - uint8_t history_max_count; // history max size -#endif - int16_t cursor; // cursor position - command_list_t command_list; // commands list -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 1 - alias_list_t alias_list; // alias list -#endif -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 1 - variable_list_t variable_list; // variables list -#endif -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - bool vt100_on; // control characters - bool escaping; // escaping input - int16_t escape_index; // escape index - char escape[MBED_CMDLINE_ESCAPE_BUFFER_SIZE]; // escape data -#endif - bool init; // true when lists are initialized already - bool insert; // insert enabled - int tab_lookup; // originally lookup characters count - int tab_lookup_cmd_n; // index in command list - int tab_lookup_n; // - bool prev_cr; // indicate if cr was last char - bool echo; // echo inputs - cmd_ready_cb_f *ready_cb; // ready cb function - cmd_list_t cmd_buffer; - cmd_exe_t *cmd_buffer_ptr; - cmd_command_t *cmd_ptr; - int8_t tasklet_id; - int8_t network_tasklet_id; - bool idle; - - cmd_print_t *out; // print cb function - void (*ctrl_fnc)(uint8_t c); // control cb function - void (*mutex_wait_fnc)(void); // mutex wait cb function - void (*mutex_release_fnc)(void); // mutex release cb function - input_passthrough_func_t passthrough_fnc; // input passthrough cb function -} cmd_class_t; - -cmd_class_t cmd = { - .init = false, - .cmd_ptr = NULL, - .mutex_wait_fnc = NULL, - .mutex_release_fnc = NULL, - .passthrough_fnc = NULL -}; - -/* Function prototypes - */ -static void cmd_init_base_commands(void); -static void cmd_replace_alias(char *input) CMDLINE_UNUSED; -static void cmd_replace_variables(char *input) CMDLINE_UNUSED; -static int cmd_parse_argv(char *string_ptr, char **argv); -static void cmd_execute(void); -static void cmd_line_clear(int from); -#if MBED_CONF_CMDLINE_ENABLE_HISTORY == 1 -static void cmd_history_item_delete(cmd_history_t *entry_ptr); -static void cmd_history_save(int16_t index); -static void cmd_history_get(uint16_t index); -static void cmd_history_clean_overflow(void); -static void cmd_history_clean(void); -static cmd_history_t *cmd_history_find(int16_t index); -static void cmd_goto_end_of_history(void) CMDLINE_UNUSED; -static void cmd_goto_beginning_of_history(void) CMDLINE_UNUSED; -#endif -static void cmd_echo(bool on); -static bool cmd_tab_lookup(void) CMDLINE_UNUSED; -static void cmd_clear_last_word(void) CMDLINE_UNUSED; -static void cmd_move_cursor_to_last_space(void) CMDLINE_UNUSED; -static void cmd_move_cursor_to_next_space(void) CMDLINE_UNUSED; -static void cmd_arrow_right() CMDLINE_UNUSED; -static void cmd_arrow_left() CMDLINE_UNUSED; -static void cmd_arrow_down() CMDLINE_UNUSED; -static void cmd_arrow_up() CMDLINE_UNUSED; -static const char *cmd_input_lookup(char *name, int namelength, int n); -static char *cmd_input_lookup_var(char *name, int namelength, int n); -static cmd_command_t *cmd_find(const char *name) CMDLINE_UNUSED; -static cmd_command_t *cmd_find_n(char *name, int nameLength, int n) CMDLINE_UNUSED; -static cmd_alias_t *alias_find(const char *alias) CMDLINE_UNUSED; -static cmd_alias_t *alias_find_n(char *alias, int aliaslength, int n) CMDLINE_UNUSED; -static cmd_variable_t *variable_find(char *variable) CMDLINE_UNUSED; -static cmd_variable_t *variable_find_n(char *variable, int length, int n) CMDLINE_UNUSED; -static void cmd_print_man(cmd_command_t *command_ptr); -static void cmd_set_input(const char *str, int cur); -static char *next_command(char *string_ptr, operator_t *mode); -static void replace_variable(char *str, cmd_variable_t *variable_ptr) CMDLINE_UNUSED; -static void cmd_variable_print_all(void) CMDLINE_UNUSED; -/** Run single command through cmd intepreter - * \param string_ptr command string with parameters - * \ret command return code (CMDLINE_RETCODE_*) - */ -static int cmd_run(char *string_ptr); -static cmd_exe_t *cmd_next_ptr(int retcode); -static void cmd_split(char *string_ptr); -static void cmd_push(char *cmd_str, operator_t oper); - -/*internal shell commands - */ -int help_command(int argc, char *argv[]); -int echo_command(int argc, char *argv[]); -int set_command(int argc, char *argv[]); -int true_command(int argc, char *argv[]); -int false_command(int argc, char *argv[]); -int alias_command(int argc, char *argv[]); -int unset_command(int argc, char *argv[]); -int clear_command(int argc, char *argv[]); -int history_command(int argc, char *argv[]); -/** Internal helper functions - */ -static const char *find_last_space(const char *from, const char *to); -static int replace_string( - char *str, int str_len, - const char *old_str, const char *new_str); - -void default_cmd_response_out(const char *fmt, va_list ap) -{ - vprintf(fmt, ap); - fflush(stdout); -} -void cmd_printf(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - cmd_vprintf(fmt, ap); - va_end(ap); -} -void cmd_vprintf(const char *fmt, va_list ap) -{ - if (cmd.mutex_wait_fnc) { - cmd.mutex_wait_fnc(); - } - cmd.out(fmt, ap); - if (cmd.mutex_release_fnc) { - cmd.mutex_release_fnc(); - } -} -/* Function definitions - */ -void cmd_init(cmd_print_t *outf) -{ - if (!cmd.init) { -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 1 - ns_list_init(&cmd.alias_list); -#endif -#if MBED_CONF_CMDLINE_ENABLE_HISTORY == 1 - ns_list_init(&cmd.history_list); -#endif - ns_list_init(&cmd.command_list); -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 1 - ns_list_init(&cmd.variable_list); -#endif - ns_list_init(&cmd.cmd_buffer); - cmd.init = true; - } - cmd.out = outf ? outf : default_cmd_response_out; - cmd.ctrl_fnc = NULL; - cmd.echo = MBED_CONF_CMDLINE_INIT_AUTOMATION_MODE == 0; - cmd.insert = true; - cmd.cursor = 0; - cmd.prev_cr = false; -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - cmd.escaping = false; - cmd.vt100_on = MBED_CONF_CMDLINE_INIT_AUTOMATION_MODE == 0; -#endif -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - cmd.history_max_count = MBED_CONF_CMDLINE_HISTORY_MAX_COUNT; -#endif - cmd.tab_lookup = 0; - cmd.tab_lookup_cmd_n = 0; - cmd.tab_lookup_n = 0; - cmd.cmd_buffer_ptr = 0; - cmd.idle = true; - cmd.ready_cb = cmd_next; - cmd.passthrough_fnc = NULL; -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES == 1 - cmd_variable_add(VAR_PROMPT, DEFAULT_PROMPT); - cmd_variable_add_int("?", 0); - //cmd_alias_add("auto-on", "set PS1=\r\nretcode=$?\r\n&&echo off"); - //cmd_alias_add("auto-off", "set PS1="DEFAULT_PROMPT"&&echo on"); -#endif -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - cmd_history_save(0); // the current line is the 0 item -#endif - cmd_line_clear(0); // clear line - cmd_init_base_commands(); - cmd_init_screen(); - return; -} -void cmd_request_screen_size(void) -{ - cmd_printf(REQUEST_SCREEN_SIZE); -} -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES == 0 -#define cmdline_get_prompt() DEFAULT_PROMPT -#else -const char *cmdline_get_prompt(void) -{ - cmd_variable_t *var_ptr = variable_find(VAR_PROMPT); - return var_ptr && var_ptr->type == VALUE_TYPE_STR ? var_ptr->value.ptr : ""; -} -#endif -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES == 0 -#define cmd_get_retfmt() MBED_CONF_CMDLINE_INIT_AUTOMATION_MODE ? DEFAULT_RETFMT : 0 -#else -const char *cmd_get_retfmt(void) -{ - cmd_variable_t *var_ptr = variable_find(VAR_RETFMT); - return var_ptr && var_ptr->type == VALUE_TYPE_STR ? var_ptr->value.ptr : 0; -} -#endif - -#if MBED_CONF_CMDLINE_INCLUDE_MAN == 1 -#define MAN_ECHO "Displays messages, or turns command echoing on or off\r\n"\ - "echo \r\n"\ - "some special parameters:\r\n"\ - " On/Off echo input characters\r\n" -#define MAN_ALIAS "alias \r\n" -#define MAN_UNSET "unset \r\n" -#define MAN_SET "set \r\n"\ - "some special parameters\r\n"\ - "--vt100 On/Off vt100 controls\r\n"\ - "--retcode On/Off retcode print after execution\r\n"\ - "--retfmt Return print format. Default: \"retcode: %i\\n\"\r\n" - -#define MAN_CLEAR "Clears the display" -#define MAN_HISTORY "Show commands history\r\n"\ - "history ()\r\n"\ - "clear Clear history\r\n" -#else -#define MAN_ECHO NULL -#define MAN_ALIAS NULL -#define MAN_SET NULL -#define MAN_UNSET NULL -#define MAN_CLEAR NULL -#define MAN_HISTORY NULL -#endif - -static void cmd_init_base_commands(void) -{ -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 1 -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES == 1 - cmd_add("set", set_command, "print or set variables", MAN_SET); - cmd_add("unset", unset_command, "unset variables", MAN_UNSET); -#endif - cmd_add("help", help_command, "This help", NULL); - cmd_add("echo", echo_command, "Echo controlling", MAN_ECHO); -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 1 - cmd_add("alias", alias_command, "Handle aliases", MAN_ALIAS); -#endif - cmd_add("clear", clear_command, "Clears the display", MAN_CLEAR); -#if MBED_CONF_CMDLINE_ENABLE_HISTORY == 1 - cmd_add("history", history_command, "View your command Line History", MAN_HISTORY); -#endif - cmd_add("true", true_command, 0, 0); - cmd_add("false", false_command, 0, 0); -#elif MBED_CONF_CMDLINE_USE_DUMMY_SET_ECHO_COMMANDS == 1 - cmd_add("set", set_command, 0, 0); - cmd_add("echo", echo_command, 0, 0); -#endif -} -void cmd_reset(void) -{ - cmd_free(); - cmd_init_base_commands(); -} -void cmd_free(void) -{ - if (!cmd.init) { - tr_warn("cmd_free() called without init"); - return; - } - ns_list_foreach_safe(cmd_command_t, cur_ptr, &cmd.command_list) { - cmd_delete(cur_ptr->name_ptr); - } -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 1 - ns_list_foreach_safe(cmd_alias_t, cur_ptr, &cmd.alias_list) { - cmd_alias_add(cur_ptr->name_ptr, NULL); - } -#endif -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 1 - ns_list_foreach_safe(cmd_variable_t, cur_ptr, &cmd.variable_list) { - if (cur_ptr->type == VALUE_TYPE_STR) { - cmd_variable_add(cur_ptr->value.ptr, NULL); - } - } -#endif -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - ns_list_foreach_safe(cmd_history_t, cur_ptr, &cmd.history_list) { - MEM_FREE(cur_ptr->command_ptr); - ns_list_remove(&cmd.history_list, cur_ptr); - MEM_FREE(cur_ptr); - } -#endif - cmd.mutex_wait_fnc = NULL; - cmd.mutex_release_fnc = NULL; - cmd.init = false; -} - -void cmd_input_passthrough_func(input_passthrough_func_t passthrough_fnc) -{ - cmd.passthrough_fnc = passthrough_fnc; -} - -void cmd_exe(char *str) -{ - if (!cmd.init) { - tr_warn("cmd_exe() called without init"); - return; - } - cmd_split(str); - if (cmd.cmd_buffer_ptr == 0) { - //execution buffer is empty - cmd.idle = false; //not really, but fake it - cmd_ready(CMDLINE_RETCODE_SUCCESS); - } else { - tr_debug("previous cmd is still in progress"); - } -} -void cmd_set_ready_cb(cmd_ready_cb_f *cb) -{ - cmd.ready_cb = cb; -} -void cmd_ready(int retcode) -{ - if (!cmd.init) { - tr_warn("cmd_ready() called without init"); - return; - } - if (cmd.cmd_ptr && cmd.cmd_ptr->busy) { - //execution finished - cmd.cmd_ptr->busy = false; - } - if (!cmd.idle) { - if (cmd.cmd_buffer_ptr == NULL) { - tr_debug("goto next command"); - } else { - tr_debug("cmd '%s' executed with retcode: %i", cmd.cmd_buffer_ptr->cmd_s, retcode); - } - if (cmd.ready_cb == NULL) { - tr_warn("Missing ready_cb! use cmd_set_ready_cb()"); - } else { - cmd.ready_cb(retcode); - } - } else { - tr_warn("Someone call cmd_ready(%i) even there shouldn't be any running cmd", retcode); - if (cmd.echo) { - cmd_output(); //refresh if this happens - } - } -} -void cmd_next(int retcode) -{ - if (!cmd.init) { - tr_warn("cmd_next() called without init"); - return; - } - cmd.idle = true; - //figure out next command - cmd.cmd_buffer_ptr = cmd_next_ptr(retcode); - if (cmd.cmd_buffer_ptr) { - cmd.idle = false; - //yep there was some -> lets execute it - retcode = cmd_run(cmd.cmd_buffer_ptr->cmd_s); - //check if execution goes to the backend or not - if (retcode == CMDLINE_RETCODE_EXCUTING_CONTINUE) { - if ((NULL != cmd.cmd_buffer_ptr) && cmd.cmd_buffer_ptr->operator == OPERATOR_BACKGROUND) { - //execution continue in background, but operator say that it's "ready" - cmd_ready(CMDLINE_RETCODE_SUCCESS); - } else { - //command execution phase continuous in background - tr_debug("Command execution continuous in background.."); - } - } else { - //execution finished -> call ready function with retcode - cmd_ready(retcode); - } - } else { - const char *retfmt = cmd_get_retfmt(); - if (retfmt) { - cmd_printf(retfmt, retcode); - } - cmd_line_clear(0); - if (cmd.echo) { - cmd_output(); //ready - } - } -} -static cmd_exe_t *cmd_pop(void) -{ - cmd_exe_t *cmd_ptr = ns_list_get_first(&cmd.cmd_buffer), - *next_cmd = ns_list_get_next(&cmd.cmd_buffer, cmd_ptr); - - if (cmd.cmd_buffer_ptr == 0) { - //was first in bool - next_cmd = ns_list_get_first(&cmd.cmd_buffer); - } else { - MEM_FREE(cmd_ptr->cmd_s); - ns_list_remove(&cmd.cmd_buffer, cmd_ptr); - MEM_FREE(cmd_ptr); - } - return next_cmd; -} - -static cmd_exe_t *cmd_next_ptr(int retcode) -{ - cmd_exe_t *next_cmd = cmd.cmd_buffer_ptr; - if (ns_list_is_empty(&cmd.cmd_buffer)) { - return NULL; - } - if (cmd.cmd_buffer_ptr == NULL) { - return cmd_pop(); - } -#if MBED_CONF_CMDLINE_ENABLE_OPERATORS == 0 - (void)retcode; -#endif - switch (cmd.cmd_buffer_ptr->operator) { -#if MBED_CONF_CMDLINE_ENABLE_OPERATORS - case (OPERATOR_AND): - if (retcode != CMDLINE_RETCODE_SUCCESS) { - //if fails, go to next command, which not have AND operator - while ((next_cmd->operator == OPERATOR_AND) && ((next_cmd = cmd_pop()) != 0)); - } else { - next_cmd = cmd_pop(); - } - break; - case (OPERATOR_OR): - if (retcode == CMDLINE_RETCODE_SUCCESS) { - //if fails, go to next command, which not have OR operator - while ((next_cmd->operator == OPERATOR_OR) && ((next_cmd = cmd_pop()) != 0)); - } else { - next_cmd = cmd_pop(); - } - break; - case (OPERATOR_BACKGROUND): - next_cmd = cmd_pop(); - break; - case (OPERATOR_PIPE): - cmd_printf("pipe is not supported\r\n"); - while ((next_cmd = cmd_pop()) != 0); - break; -#endif - case (OPERATOR_SEMI_COLON): - default: - //get next command to be execute (might be null if there is no more) - next_cmd = cmd_pop(); - break; - } - - //return next command if any - return next_cmd; -} -static void cmd_split(char *string_ptr) -{ - char *ptr = string_ptr, *next; - operator_t oper = OPERATOR_SEMI_COLON; - do { - next = next_command(ptr, &oper); - cmd_push(ptr, oper); - ptr = next; - if (next && !*next) { - break; - } - } while (ptr != 0); -} - -static void cmd_push(char *cmd_str, operator_t oper) -{ - //store this command to the stack - cmd_exe_t *cmd_ptr = MEM_ALLOC(sizeof(cmd_exe_t)); - if (cmd_ptr == NULL) { - tr_error("mem alloc failed in cmd_push"); - return; - } - cmd_ptr->cmd_s = MEM_ALLOC(strlen(cmd_str) + 1); - if (cmd_ptr->cmd_s == NULL) { - MEM_FREE(cmd_ptr); - tr_error("mem alloc failed in cmd_push cmd_s"); - return; - } - strcpy(cmd_ptr->cmd_s, cmd_str); - cmd_ptr->operator = oper; - ns_list_add_to_end(&cmd.cmd_buffer, cmd_ptr); -} -void cmd_out_func(cmd_print_t *outf) -{ - cmd.out = outf; -} -void cmd_ctrl_func(void (*sohf)(uint8_t c)) -{ - cmd.ctrl_fnc = sohf; -} - -void cmd_mutex_wait_func(void (*mutex_wait_f)(void)) -{ - cmd.mutex_wait_fnc = mutex_wait_f; -} -void cmd_mutex_release_func(void (*mutex_release_f)(void)) -{ - cmd.mutex_release_fnc = mutex_release_f; -} - -void cmd_mutex_lock() -{ - if (cmd.mutex_wait_fnc) { - cmd.mutex_wait_fnc(); - } -} - -void cmd_mutex_unlock() -{ - if (cmd.mutex_release_fnc) { - cmd.mutex_release_fnc(); - } -} -void cmd_init_screen() -{ -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - if (cmd.vt100_on) { - cmd_printf(CR_S CLEAR_ENTIRE_SCREEN); /* Clear screen */ - cmd_printf(ENABLE_AUTO_WRAP_MODE); /* enable line wrap */ - } -#endif - cmd_printf(MBED_CONF_CMDLINE_BOOT_MESSAGE); - cmd_output(); -} -uint8_t cmd_history_size(uint8_t max) -{ -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - if (max > 0) { - cmd.history_max_count = max; - cmd_history_clean_overflow(); - } - return cmd.history_max_count; -#else - (void)max; - return 0; -#endif -} -static void cmd_echo(bool on) -{ - cmd.echo = on; -} -bool cmd_echo_state(void) -{ - return cmd.echo; -} -static cmd_command_t *cmd_find_n(char *name, int nameLength, int n) -{ - cmd_command_t *cmd_ptr = NULL; - if (name != NULL && nameLength != 0) { - int i = 0; - ns_list_foreach(cmd_command_t, cur_ptr, &cmd.command_list) { - if (strncmp(name, cur_ptr->name_ptr, nameLength) == 0) { - if (i == n) { - cmd_ptr = cur_ptr; - break; - } - i++; - } - } - } - return cmd_ptr; -} -static const char *cmd_input_lookup(char *name, int namelength, int n) -{ - const char *str = NULL; - cmd_command_t *cmd_ptr = cmd_find_n(name, namelength, n); - if (cmd_ptr) { - str = cmd_ptr->name_ptr; - cmd.tab_lookup_n = n + 1; - } else { - n -= cmd.tab_lookup_n; -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 1 - cmd_alias_t *alias = alias_find_n(name, namelength, n); - if (alias) { - str = (const char *)alias->name_ptr; - } -#endif - } - - return str; -} -static char *cmd_input_lookup_var(char *name, int namelength, int n) -{ - char *str = NULL; - cmd_variable_t *var = variable_find_n(name, namelength, n); - if (var) { - str = var->name_ptr; - } - return str; -} -static cmd_command_t *cmd_find(const char *name) -{ - cmd_command_t *cmd_ptr = NULL; - if (name == NULL || strlen(name) == 0) { - tr_error("cmd_find invalid parameters"); - return NULL; - } - - ns_list_foreach(cmd_command_t, cur_ptr, &cmd.command_list) { - if (strcmp(name, cur_ptr->name_ptr) == 0) { - cmd_ptr = cur_ptr; - break; - } - } - return cmd_ptr; -} - -void cmd_add(const char *name, cmd_run_cb *callback, const char *info, const char *man) -{ - cmd_command_t *cmd_ptr; - - if (name == NULL || callback == NULL || strlen(name) == 0) { - tr_warn("cmd_add invalid parameters"); - return; - } - cmd_ptr = (cmd_command_t *)MEM_ALLOC(sizeof(cmd_command_t)); - if (cmd_ptr == NULL) { - tr_error("mem alloc failed in cmd_add"); - return; - } - cmd_ptr->name_ptr = name; - cmd_ptr->info_ptr = info; -#if MBED_CONF_CMDLINE_INCLUDE_MAN == 1 - cmd_ptr->man_ptr = man; -#else - (void)man; - cmd_ptr->man_ptr = 0; -#endif - cmd_ptr->run_cb = callback; - cmd_ptr->busy = false; - ns_list_add_to_end(&cmd.command_list, cmd_ptr); - return; -} - -void cmd_delete(const char *name) -{ - cmd_command_t *cmd_ptr; - cmd_ptr = cmd_find(name); - if (cmd_ptr == NULL) { - return; - } - ns_list_remove(&cmd.command_list, cmd_ptr); - MEM_FREE(cmd_ptr); - return; -} -static void replace_escapes(char *string_ptr) -{ - while ((string_ptr = strchr(string_ptr, '\\')) != NULL) { - memmove(string_ptr, string_ptr + 1, strlen(string_ptr + 1) + 1); - string_ptr++; - } -} -static int cmd_parse_argv(char *string_ptr, char **argv) -{ - tr_deep("cmd_parse_argv(%s, ..)\r\n", string_ptr); - int argc = 0; - char *str_ptr, *end_quote_ptr = NULL; - - if (string_ptr == NULL || strlen(string_ptr) == 0) { - tr_error("Invalid parameters"); - return 0; - } - str_ptr = string_ptr; - do { - argv[argc] = str_ptr; - // tr_deep("parsing.. argv[%d]: %s\r\n", argc, str_ptr); - if (*str_ptr != '\\') { - if (*str_ptr == '"') { - // check if end quote - end_quote_ptr = str_ptr; - do { - end_quote_ptr = strchr(end_quote_ptr + 1, '\"'); - if (end_quote_ptr == NULL) { - break; - } - } while (*(end_quote_ptr - 1) == '\\'); - if (end_quote_ptr != NULL) { - // remove quotes give as one parameter - argv[argc]++; - str_ptr = end_quote_ptr; - } else { - str_ptr = strchr(str_ptr, ' '); - } - } else { - str_ptr = strchr(str_ptr, ' '); - } - } else { - str_ptr = strchr(str_ptr, ' '); - } - argc++; // one argument parsed - if (str_ptr == NULL) { - break; - } - if (argc > MBED_CONF_CMDLINE_ARGS_MAX_COUNT) { - tr_warn("Maximum arguments (%d) reached", MBED_CONF_CMDLINE_ARGS_MAX_COUNT); - break; - } - *str_ptr++ = 0; - replace_escapes(argv[argc - 1]); - // tr_deep("parsed argv[%d]: %s\r\n", argc-1, argv[argc-1]); - while (*str_ptr == ' ') { - str_ptr++; // skip spaces - }; - } while (*str_ptr != 0); - return argc; -} -static void cmd_print_man(cmd_command_t *command_ptr) -{ - if (command_ptr->man_ptr) { - cmd_printf("%s\r\n", command_ptr->man_ptr); - } -} -static void cmd_set_input(const char *str, int cur) -{ - cmd_line_clear(cur); - strcpy(cmd.input + cur, str); - cmd.cursor = strlen(cmd.input); -} -/** - * If oper is not null, function set null pointers - */ -static char *next_command(char *string_ptr, operator_t *oper) -{ - char *ptr = string_ptr; - bool quote = false; -#if MBED_CONF_CMDLINE_ENABLE_OPERATORS == 0 - (void)oper; -#endif - while (*ptr != 0) { - if (quote) { - if (*ptr == '"') { - quote = false; - } - } else { - //skip if previous character is '\' - if ((ptr == string_ptr) || (*(ptr - 1) != '\\')) { - switch (*ptr) { - case ('"'): { - quote = true; - break; - } -#if MBED_CONF_CMDLINE_ENABLE_OPERATORS - case (';'): //default operator - if (oper) { - *oper = OPERATOR_SEMI_COLON; - *ptr = 0; - } - return ptr + 1; - case ('&'): - if (ptr[1] == '&') { - if (oper) { - *oper = OPERATOR_AND; - *ptr = 0; - } - return ptr + 2; - } else { - if (oper) { - *oper = OPERATOR_BACKGROUND; - *ptr = 0; - } - return ptr + 1; - } - case ('|'): - if (ptr[1] == '|') { - if (oper) { - *oper = OPERATOR_OR; - *ptr = 0; - } - return ptr + 2; - } else { - tr_warn("pipe operator not supported"); - if (oper) { - *oper = OPERATOR_PIPE; - *ptr = 0; - } - return ptr + 1; - } -#endif - default: - break; - } - } - } - ptr++; - } - return 0; -} -static int cmd_run(char *string_ptr) -{ - char *argv[MBED_CONF_CMDLINE_ARGS_MAX_COUNT]; - int argc, ret; - - tr_info("Executing cmd: '%s'", string_ptr); - char *command_str = MEM_ALLOC(MBED_CONF_CMDLINE_MAX_LINE_LENGTH); - if (command_str == NULL) { - tr_error("mem alloc failed in cmd_run"); - return CMDLINE_RETCODE_FAIL; - } - while (isspace((unsigned char) *string_ptr) && - *string_ptr != '\n' && - *string_ptr != 0) { - string_ptr++; //skip white spaces - } - strcpy(command_str, string_ptr); - tr_deep("cmd_run('%s') ", command_str); -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 1 - cmd_replace_alias(command_str); -#endif -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 1 - cmd_replace_variables(command_str); -#endif - tr_debug("Parsed cmd: '%s'", command_str); - - argc = cmd_parse_argv(command_str, argv); - - cmd.cmd_ptr = cmd_find(argv[0]); - - if (cmd.cmd_ptr == NULL) { - cmd_printf("Command '%s' not found.\r\n", argv[0]); - MEM_FREE(command_str); - ret = CMDLINE_RETCODE_COMMAND_NOT_FOUND; -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES == 1 - cmd_variable_add_int("?", ret); - cmd_alias_add("_", string_ptr); // last executed command -#endif - return ret; - } - if (cmd.cmd_ptr->run_cb == NULL) { - tr_error("Command callback missing"); - MEM_FREE(command_str); - return CMDLINE_RETCODE_COMMAND_CB_MISSING; - } - - if (argc == 2 && - (cmd_has_option(argc, argv, "h") || cmd_parameter_index(argc, argv, "--help") > 0)) { - MEM_FREE(command_str); - cmd_print_man(cmd.cmd_ptr); - return CMDLINE_RETCODE_SUCCESS; - } - - if (cmd.cmd_ptr->busy) { - MEM_FREE(command_str); - return CMDLINE_RETCODE_COMMAND_BUSY; - } - - // Run the actual callback - cmd.cmd_ptr->busy = true; - ret = cmd.cmd_ptr->run_cb(argc, argv); -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_VARIABLES == 1 - cmd_variable_add_int("?", ret); - cmd_alias_add("_", string_ptr); // last executed command -#endif - MEM_FREE(command_str); - switch (ret) { - case (CMDLINE_RETCODE_COMMAND_NOT_IMPLEMENTED): - tr_warn("Command not implemented"); - break; - case (CMDLINE_RETCODE_INVALID_PARAMETERS): - tr_warn("Command parameter was incorrect"); - cmd_printf("Invalid parameters!\r\n"); - cmd_print_man(cmd.cmd_ptr); - break; - default: - break; - } - return ret; -} -void cmd_escape_start(void) -{ -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - cmd.escaping = true; - memset(cmd.escape, 0, sizeof(cmd.escape)); - cmd.escape_index = 0; -#endif -} -static void cmd_arrow_right() -{ -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - - /* @todo handle shift - if(strncmp(cmd.escape+1, "1;2", 3) == 0) { - tr_debug("Shift pressed"); - shift = true; - } - */ - if ((cmd.escape_index == 1 && cmd.escape[0] == 'O') || - (cmd.escape_index == 4 && strncmp(cmd.escape + 1, "1;5", 3) == 0)) { - cmd_move_cursor_to_next_space(); - } else { - cmd.cursor ++; - } - if ((int)cmd.cursor > (int)strlen(cmd.input)) { - cmd.cursor = strlen(cmd.input); - } -#endif -} -static void cmd_arrow_left() -{ -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - /* @todo handle shift - if(strncmp(cmd.escape+1, "1;2", 3) == 0) { - tr_debug("Shift pressed"); - shift = true; - } - */ - if ((cmd.escape_index == 1 && cmd.escape[0] == 'O') || - (cmd.escape_index == 4 && strncmp(cmd.escape + 1, "1;5", 3) == 0)) { - cmd_move_cursor_to_last_space(); - } else { - cmd.cursor --; - } - if (cmd.cursor < 0) { - cmd.cursor = 0; - } -#endif -} -static void cmd_arrow_up() -{ -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - int16_t old_entry = cmd.history++; - if (NULL == cmd_history_find(cmd.history)) { - cmd.history = old_entry; - } - if (old_entry != cmd.history) { - cmd_history_save(old_entry); - cmd_history_get(cmd.history); - } -#endif -} -static void cmd_arrow_down() -{ -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - - int16_t old_entry = cmd.history--; - if (cmd.history < 0) { - cmd.history = 0; - } - - if (old_entry != cmd.history) { - cmd_history_save(old_entry); - cmd_history_get(cmd.history); - } -#endif -} -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 -void cmd_escape_read(int16_t u_data) -{ - tr_debug("cmd_escape_read: %02x '%c' escape_index: %d: %s", - u_data, - (isprint(u_data) ? u_data : '?'), - cmd.escape_index, - cmd.escape); - - if (u_data == 'D') { - cmd_arrow_left(); - } else if (u_data == 'C') { - cmd_arrow_right(); -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - } else if (u_data == 'A') { - cmd_arrow_up(); - } else if (u_data == 'B') { - cmd_arrow_down(); -#endif - } else if (u_data == 'Z') { - // Shift+TAB - if (cmd.tab_lookup > 0) { - cmd.cursor = cmd.tab_lookup; - cmd.input[cmd.tab_lookup] = 0; - if (cmd.tab_lookup_cmd_n > 0) { - cmd.tab_lookup_cmd_n--; - } - } - cmd_tab_lookup(); - } else if (u_data == 'b') { - cmd_move_cursor_to_last_space(); - } else if (u_data == 'f') { - cmd_move_cursor_to_next_space(); - } else if (u_data == 'n') { - if (cmd.escape[1] == '5') { - // Device status report - // Response: terminal is OK - cmd_printf("%c0n", ESC); - } else if (cmd.escape[1] == '6') { - // Get cursor position - cmd_printf(ESCAPE("%d%d"), 0, cmd.cursor); - } - } else if (u_data == 'R') { - // response for Get cursor position ([6n) - // [;R - char *ptr; - int lines = strtol(cmd.escape + 1, &ptr, 10); - if (ptr == NULL) { - tr_warn("Invalid response: %s%c", cmd.escape, u_data); - } else { - int cols = strtol(ptr + 1, 0, 10); - tr_debug("Lines: %d, cols: %d", lines, cols); - cmd_variable_add_int("LINES", lines); - cmd_variable_add_int("COLUMNS", cols); - } - } else if (u_data == 'H') { - // Xterm support - cmd.cursor = 0; - } else if (u_data == 'F') { - // Xterm support - cmd.cursor = strlen(cmd.input); - } else if (isdigit((int)cmd.escape[cmd.escape_index - 1]) && u_data == '~') { - switch (cmd.escape[cmd.escape_index - 1]) { - case ('1'): //beginning-of-line # Home key - cmd.cursor = 0; - break; - case ('2'): //quoted-insert # Insert key - cmd.insert = !cmd.insert; - break; - case ('3'): //delete-char # Delete key - if ((int)strlen(cmd.input) > (int)cmd.cursor) { - memmove(&cmd.input[cmd.cursor], &cmd.input[cmd.cursor + 1], strlen(&cmd.input[cmd.cursor + 1]) + 1); - } - break; -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - case ('4'): //end-of-line # End key - cmd.cursor = strlen(cmd.input); - break; - case ('5'): //beginning-of-history # PageUp key - cmd_goto_end_of_history(); - break; - case ('6'): //end-of-history # PageDown key - cmd_goto_beginning_of_history(); - break; -#endif - default: - break; - } -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - } else if (isprint(u_data)) { //IS_NUMBER || IS_CONTROL - cmd.escape[cmd.escape_index++] = u_data; - return; - } - cmd.escaping = false; -#endif - cmd_output(); - return; -} -#endif -#if MBED_CONF_CMDLINE_ENABLE_HISTORY -static void cmd_goto_end_of_history(void) -{ - // handle new input if any and verify that - // it is not already in beginning of history or current position - bool allowStore = strlen(cmd.input) != 0; //avoid store empty lines to history - cmd_history_t *entry_ptr; - if (cmd.history > 0 && allowStore) { - entry_ptr = cmd_history_find(cmd.history); - if (entry_ptr) { - if (strcmp(entry_ptr->command_ptr, cmd.input) == 0) { - // current history contains contains same text as input - allowStore = false; - } - } - } else if (allowStore && (entry_ptr = cmd_history_find(0)) != NULL) { - if (strcmp(entry_ptr->command_ptr, cmd.input) == 0) { - //beginning of history was same text as input - allowStore = false; - } - } - if (allowStore) { - cmd_history_save(0); // new is saved to place 0 - cmd_history_save(-1); // new is created to the current one - } - cmd_history_t *cmd_ptr = ns_list_get_last(&cmd.history_list); - cmd_set_input(cmd_ptr->command_ptr, 0); - cmd.history = ns_list_count(&cmd.history_list) - 1; -} -static void cmd_goto_beginning_of_history(void) -{ - cmd_history_t *cmd_ptr = ns_list_get_first(&cmd.history_list); - cmd_set_input(cmd_ptr->command_ptr, 0); - cmd.history = 0; -} -#endif -static void cmd_reset_tab(void) -{ - cmd.tab_lookup = 0; - cmd.tab_lookup_cmd_n = 0; - cmd.tab_lookup_n = 0; -} -void cmd_char_input(int16_t u_data) -{ - if (cmd.prev_cr && u_data == '\n') { - // ignore \n if previous character was \r -> - // that triggers execute so \n does not need to anymore - cmd.prev_cr = false; // unset to ensure we doesn't go here anymore - return; - } - /*Handle passthrough*/ - if (cmd.passthrough_fnc != NULL) { - cmd.passthrough_fnc(u_data); - return; - } -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - /*handle ecape command*/ - if (cmd.escaping == true) { - cmd_escape_read(u_data); - return; - } -#endif - - tr_debug("input char: %02x '%c', cursor: %i, input: \"%s\"", u_data, (isprint(u_data) ? u_data : ' '), cmd.cursor, cmd.input); - - /*Normal character input*/ - if (u_data == '\r' || u_data == '\n') { - cmd.prev_cr = u_data == '\r'; - cmd_reset_tab(); - if (strlen(cmd.input) == 0) { - if (cmd.echo) { - cmd_printf("\r\n"); - cmd_output(); - } - } else { - if (cmd.echo) { - cmd_printf("\r\n"); - } - cmd_execute(); - } - } else if (u_data == ETX || u_data == CAN) { - //ctrl+c (End of text) or ctrl+x (cancel) - cmd_reset_tab(); - cmd_line_clear(0); - if (!cmd.idle) { - cmd_ready(CMDLINE_RETCODE_FAIL); - } - if (cmd.echo) { - cmd_output(); - } -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - } else if (u_data == ESC) { - cmd_escape_start(); - } else if (u_data == BS || u_data == DEL) { - cmd_reset_tab(); - cmd.cursor--; - if (cmd.cursor < 0) { - cmd.cursor = 0; - return; - } - memmove(&cmd.input[cmd.cursor], &cmd.input[cmd.cursor + 1], strlen(&cmd.input[cmd.cursor + 1]) + 1); - if (cmd.echo) { - cmd_output(); - } - } else if (u_data == ETB) { - //ctrl+w (End of xmit block) - tr_debug("ctrl+w - remove last word to cursor"); - cmd_clear_last_word(); - if (cmd.echo) { - cmd_output(); - } - } else if (u_data == TAB) { - bool inc = false; - if (cmd.tab_lookup > 0) { - cmd.cursor = cmd.tab_lookup; - cmd.input[cmd.tab_lookup] = 0; - cmd.tab_lookup_cmd_n++; - inc = true; - } else { - cmd.tab_lookup = strlen(cmd.input); - } - - if (!cmd_tab_lookup()) { - if (inc) { - cmd.tab_lookup_cmd_n--; - } - memset(cmd.input + cmd.tab_lookup, 0, MBED_CONF_CMDLINE_MAX_LINE_LENGTH - cmd.tab_lookup); - } - if (cmd.echo) { - cmd_output(); - } - - } else if (iscntrl(u_data)) { - if (cmd.ctrl_fnc) { - cmd.ctrl_fnc(u_data); - } -#endif - } else { - cmd_reset_tab(); - tr_deep("cursor: %d, inputlen: %lu, u_data: %c\r\n", cmd.cursor, strlen(cmd.input), u_data); - if ((strlen(cmd.input) >= MBED_CONF_CMDLINE_MAX_LINE_LENGTH - 1) || - (cmd.cursor >= MBED_CONF_CMDLINE_MAX_LINE_LENGTH - 1)) { - tr_warn("input buffer full"); - if (cmd.echo) { - cmd_output(); - } - return; - } - if (cmd.insert) { - memmove(&cmd.input[cmd.cursor + 1], &cmd.input[cmd.cursor], strlen(&cmd.input[cmd.cursor]) + 1); - } - cmd.input[cmd.cursor++] = u_data; - if (cmd.echo) { - cmd_output(); - } - } -} -static int check_variable_keylookup_size(char **key, int *keysize) -{ - if (cmd.cursor > 0 && cmd.tab_lookup > 0) { - //printf("tab_lookup: %i\r\n", cmd.tab_lookup); - char *ptr = cmd.input + cmd.tab_lookup; - do { - //printf("varkey lookup: %c\r\n", *ptr); - if (*ptr == ' ') { - return 0; - } - if (*ptr == '$') { - int varlen = cmd.tab_lookup - (ptr - cmd.input) - 1; - *key = ptr; - *keysize = varlen; - //printf("varkey size: %i\r\n", varlen); - return (ptr - cmd.input); - } - ptr--; - } while (ptr > cmd.input); - } - return 0; -} -bool cmd_tab_lookup(void) -{ - int len = strlen(cmd.input); - if (len == 0) { - return false; - } - char *variable_keypart; - int lookupSize; - int varpos = check_variable_keylookup_size(&variable_keypart, &lookupSize); - - const char *str = NULL; - if (varpos) { - str = cmd_input_lookup_var(variable_keypart + 1, lookupSize, cmd.tab_lookup_cmd_n); - if (str) { - cmd_set_input(str, varpos + 1); - return true; - } - } else { - str = cmd_input_lookup(cmd.input, len, cmd.tab_lookup_cmd_n); - if (str != NULL) { - cmd_set_input(str, 0); - return true; - } - } - return false; -} -static void cmd_move_cursor_to_last_space(void) -{ - if (cmd.cursor) { - cmd.cursor--; - } else { - return; - } - const char *last_space = find_last_space(cmd.input + cmd.cursor, cmd.input); - if (last_space) { - cmd.cursor = last_space - cmd.input; - } else { - cmd.cursor = 0; - } -} -static void cmd_move_cursor_to_next_space(void) -{ - while (cmd.input[cmd.cursor] == ' ') { - cmd.cursor++; - } - const char *next_space = strchr(cmd.input + cmd.cursor, ' '); - if (next_space) { - cmd.cursor = next_space - cmd.input; - } else { - cmd.cursor = (int)strlen(cmd.input); - } -} -static void cmd_clear_last_word() -{ - if (!cmd.cursor) { - return; - } - char *ptr = cmd.input + cmd.cursor - 1; - while (*ptr == ' ' && ptr >= cmd.input) { - ptr--; - } - const char *last_space = find_last_space(ptr, cmd.input); - if (last_space) { - memmove((void *)last_space, &cmd.input[cmd.cursor], strlen(cmd.input + cmd.cursor) + 1); - cmd.cursor = last_space - cmd.input; - } else { - memmove((void *)cmd.input, &cmd.input[cmd.cursor], strlen(cmd.input + cmd.cursor) + 1); - cmd.cursor = 0; - } -} -void cmd_output(void) -{ -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - if (cmd.vt100_on && cmd.idle) { - int curpos = (int)strlen(cmd.input) - cmd.cursor + 1; - cmd_printf(CR_S CLEAR_ENTIRE_LINE "%s%s " MOVE_CURSOR_LEFT_N_CHAR, - cmdline_get_prompt(), cmd.input, curpos); - } -#endif -} -void cmd_echo_off(void) -{ - cmd_echo(false); -} -void cmd_echo_on(void) -{ - cmd_echo(true); -} -// alias -int replace_alias(char *str, const char *old_str, const char *new_str) -{ -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 0 - (void)str; - (void)old_str; - (void)new_str; -#else - int old_len = strlen(old_str), - new_len = strlen(new_str); - if ((strncmp(str, old_str, old_len) == 0) && - ((str[ old_len ] == ' ') || (str[ old_len ] == 0) || - (str[ old_len ] == ';') || (str[ old_len ] == '&'))) { - memmove(str + new_len, str + old_len, strlen(str + old_len) + 1); - memcpy(str, new_str, new_len); - return new_len - old_len; - } -#endif - return 0; -} -static void cmd_replace_alias(char *input) -{ -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 0 - (void)input; -#else - ns_list_foreach(cmd_alias_t, cur_ptr, &cmd.alias_list) { - replace_alias(input, cur_ptr->name_ptr, cur_ptr->value_ptr); - } -#endif -} -//variable -static void replace_variable(char *str, cmd_variable_t *variable_ptr) -{ - const char *name = variable_ptr->name_ptr; - int name_len = strlen(variable_ptr->name_ptr); - char *value; - char valueLocal[11]; - if (variable_ptr->type == VALUE_TYPE_STR) { - value = variable_ptr->value.ptr; - } else { - value = valueLocal; - snprintf(value, 11, "%d", variable_ptr->value.i); - } - char *tmp = MEM_ALLOC(name_len + 2); - if (tmp == NULL) { - tr_error("mem alloc failed in replace_variable"); - return; - } - tmp[0] = '$'; - strcpy(tmp + 1, name); - replace_string(str, MBED_CONF_CMDLINE_MAX_LINE_LENGTH, tmp, value); - MEM_FREE(tmp); -} -static void cmd_replace_variables(char *input) -{ -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 0 - (void)input; -#else - ns_list_foreach(cmd_variable_t, cur_ptr, &cmd.variable_list) { - replace_variable(input, cur_ptr); - } -#endif -} -//history -#if MBED_CONF_CMDLINE_ENABLE_HISTORY == 1 -static void cmd_history_item_delete(cmd_history_t *entry_ptr) -{ - ns_list_remove(&cmd.history_list, entry_ptr); - MEM_FREE(entry_ptr->command_ptr); - MEM_FREE(entry_ptr); -} -static cmd_history_t *cmd_history_find(int16_t index) -{ - cmd_history_t *entry_ptr = NULL; - int16_t count = 0; - ns_list_foreach(cmd_history_t, cur_ptr, &cmd.history_list) { - if (count == index) { - entry_ptr = cur_ptr; - break; - } - count++; - } - return entry_ptr; -} - -static void cmd_history_clean_overflow(void) -{ - while (ns_list_count(&cmd.history_list) > cmd.history_max_count) { - cmd_history_t *cmd_ptr = ns_list_get_last(&cmd.history_list); - tr_debug("removing older history (%s)", cmd_ptr->command_ptr); - cmd_history_item_delete(cmd_ptr); - } -} -static void cmd_history_clean(void) -{ - while (ns_list_count(&cmd.history_list) > 0) { - tr_debug("removing older history"); - cmd_history_item_delete(ns_list_get_last(&cmd.history_list)); - } -} -static void cmd_history_save(int16_t index) -{ - /*if entry true save it to first item which is the one currently edited*/ - cmd_history_t *entry_ptr; - int16_t len; - - len = strlen(cmd.input); - - tr_debug("saving history item %d", index); - entry_ptr = cmd_history_find(index); - - if (entry_ptr == NULL) { - /*new entry*/ - entry_ptr = (cmd_history_t *)MEM_ALLOC(sizeof(cmd_history_t)); - if (entry_ptr == NULL) { - tr_error("mem alloc failed in cmd_history_save"); - return; - } - entry_ptr->command_ptr = NULL; - ns_list_add_to_start(&cmd.history_list, entry_ptr); - } - - if (entry_ptr->command_ptr != NULL) { - MEM_FREE(entry_ptr->command_ptr); - } - entry_ptr->command_ptr = (char *)MEM_ALLOC(len + 1); - if (entry_ptr->command_ptr == NULL) { - tr_error("mem alloc failed in cmd_history_save command_ptr"); - cmd_history_item_delete(entry_ptr); - return; - } - strcpy(entry_ptr->command_ptr, cmd.input); - - cmd_history_clean_overflow(); -} -static void cmd_history_get(uint16_t index) -{ - cmd_history_t *entry_ptr; - - tr_debug("getting history item %d", index); - - entry_ptr = cmd_history_find(index); - - if (entry_ptr != NULL) { - memset(cmd.input, 0, MBED_CONF_CMDLINE_MAX_LINE_LENGTH); - cmd_set_input(entry_ptr->command_ptr, 0); - } -} -#endif -static void cmd_line_clear(int from) -{ - memset(cmd.input + from, 0, MBED_CONF_CMDLINE_MAX_LINE_LENGTH - from); - cmd.cursor = from; -} - -static void cmd_execute(void) -{ -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - if (strlen(cmd.input) != 0) { - bool noduplicates = true; - cmd_history_t *entry_ptr = cmd_history_find(0); - if (entry_ptr) { - if (strcmp(entry_ptr->command_ptr, cmd.input) == 0) { - noduplicates = false; - } - } - if (noduplicates) { - cmd_history_save(0); // new is saved to place 0 - cmd_history_save(-1); // new is created to the current one - } - } - cmd.history = 0; -#endif - tr_deep("cmd_execute('%s') ", cmd.input); - cmd_exe(cmd.input); - cmd_line_clear(0); -} - - -static cmd_alias_t *alias_find(const char *alias) -{ -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 0 - (void)alias; - return NULL; -#else - cmd_alias_t *alias_ptr = NULL; - if (alias == NULL || strlen(alias) == 0) { - tr_error("alias_find invalid parameters"); - return NULL; - } - - ns_list_foreach(cmd_alias_t, cur_ptr, &cmd.alias_list) { - if (strcmp(alias, cur_ptr->name_ptr) == 0) { - alias_ptr = cur_ptr; - break; - } - } - return alias_ptr; -#endif -} - -static cmd_alias_t *alias_find_n(char *alias, int aliaslength, int n) -{ - cmd_alias_t *alias_ptr = NULL; - if (alias == NULL || strlen(alias) == 0) { - tr_error("alias_find invalid parameters"); - return NULL; - } -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 0 - (void)aliaslength; - (void)n; -#else - int i = 0; - ns_list_foreach(cmd_alias_t, cur_ptr, &cmd.alias_list) { - if (strncmp(alias, cur_ptr->name_ptr, aliaslength) == 0) { - if (i == n) { - alias_ptr = cur_ptr; - break; - } - i++; - } - } -#endif - return alias_ptr; -} -static cmd_variable_t *variable_find(char *variable) -{ - cmd_variable_t *variable_ptr = NULL; - if (variable == NULL || strlen(variable) == 0) { - tr_error("variable_find invalid parameters"); - return NULL; - } -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 1 - ns_list_foreach(cmd_variable_t, cur_ptr, &cmd.variable_list) { - if (strcmp(variable, cur_ptr->name_ptr) == 0) { - variable_ptr = cur_ptr; - break; - } - } -#endif - return variable_ptr; -} -static cmd_variable_t *variable_find_n(char *variable, int length, int n) -{ - cmd_variable_t *variable_ptr = NULL; - if (variable == NULL || strlen(variable) == 0) { - tr_error("variable_find invalid parameters"); - return NULL; - } -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 0 - (void)length; - (void)n; -#else - int i = 0; - ns_list_foreach(cmd_variable_t, cur_ptr, &cmd.variable_list) { - if (strncmp(variable, cur_ptr->name_ptr, length) == 0) { - if (i == n) { - variable_ptr = cur_ptr; - break; - } - i++; - } - } -#endif - return variable_ptr; -} -static void cmd_alias_print_all(void) -{ -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 1 - ns_list_foreach(cmd_alias_t, cur_ptr, &cmd.alias_list) { - if (cur_ptr->name_ptr != NULL) { - cmd_printf("%-18s'%s'\r\n", cur_ptr->name_ptr, cur_ptr->value_ptr ? cur_ptr->value_ptr : ""); - } - } - return; -#endif -} -static void cmd_variable_print_all(void) -{ -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 1 - ns_list_foreach(cmd_variable_t, cur_ptr, &cmd.variable_list) { - if (cur_ptr->type == VALUE_TYPE_STR) { - cmd_printf("%s='%s'\r\n", cur_ptr->name_ptr, cur_ptr->value.ptr ? cur_ptr->value.ptr : ""); - } else if (cur_ptr->type == VALUE_TYPE_INT) { - cmd_printf("%s=%d\r\n", cur_ptr->name_ptr, cur_ptr->value.i); - } - } - return; -#endif -} - -void cmd_alias_add(const char *alias, const char *value) -{ -#if MBED_CONF_CMDLINE_ENABLE_ALIASES == 0 - (void)alias; - (void)value; -#else - cmd_alias_t *alias_ptr; - if (alias == NULL || strlen(alias) == 0) { - tr_warn("cmd_alias_add invalid parameters"); - return; - } - alias_ptr = alias_find(alias); - if (alias_ptr == NULL) { - if (value == NULL) { - return; // no need to add new null one - } - if (strlen(value) == 0) { - return; // no need to add new empty one - } - alias_ptr = (cmd_alias_t *)MEM_ALLOC(sizeof(cmd_alias_t)); - if (alias_ptr == NULL) { - tr_error("Mem alloc fail in cmd_alias_add"); - return; - } - alias_ptr->name_ptr = (char *)MEM_ALLOC(strlen(alias) + 1); - if (alias_ptr->name_ptr == NULL) { - MEM_FREE(alias_ptr); - tr_error("Mem alloc fail in cmd_alias_add name_ptr"); - return; - } - ns_list_add_to_end(&cmd.alias_list, alias_ptr); - strcpy(alias_ptr->name_ptr, alias); - alias_ptr->value_ptr = NULL; - } - if (value == NULL || strlen(value) == 0) { - // delete this one - ns_list_remove(&cmd.alias_list, alias_ptr); - MEM_FREE(alias_ptr->name_ptr); - MEM_FREE(alias_ptr->value_ptr); - MEM_FREE(alias_ptr); - } else { - // add new or modify - if (alias_ptr->value_ptr != NULL) { - MEM_FREE(alias_ptr->value_ptr); - } - alias_ptr->value_ptr = (char *)MEM_ALLOC(strlen(value) + 1); - if (alias_ptr->value_ptr == NULL) { - cmd_alias_add(alias, NULL); - tr_error("Mem alloc fail in cmd_alias_add value_ptr"); - return; - } - strcpy(alias_ptr->value_ptr, value); - } - return; -#endif -} -static cmd_variable_t *cmd_variable_add_prepare(char *variable, char *value) -{ -#if MBED_CONF_CMDLINE_ENABLE_INTERNAL_COMMANDS == 0 - (void)variable; - (void)value; - return NULL; -#else - if (variable == NULL || strlen(variable) == 0) { - tr_warn("cmd_variable_add invalid parameters"); - return NULL; - } - cmd_variable_t *variable_ptr = variable_find(variable); - if (variable_ptr == NULL) { - if (value == NULL) { - return NULL; // adding null variable - } - if (strlen(value) == 0) { - return NULL; // no need to add new empty one - } - variable_ptr = (cmd_variable_t *)MEM_ALLOC(sizeof(cmd_variable_t)); - if (variable_ptr == NULL) { - tr_error("Mem alloc failed cmd_variable_add"); - return NULL; - } - variable_ptr->name_ptr = (char *)MEM_ALLOC(strlen(variable) + 1); - if (variable_ptr->name_ptr == NULL) { - MEM_FREE(variable_ptr); - tr_error("Mem alloc failed cmd_variable_add name_ptr"); - return NULL; - } - - ns_list_add_to_end(&cmd.variable_list, variable_ptr); - strcpy(variable_ptr->name_ptr, variable); - variable_ptr->value.ptr = NULL; - } - if (value == NULL || strlen(value) == 0) { - // delete this one - tr_debug("Remove variable: %s", variable); - ns_list_remove(&cmd.variable_list, variable_ptr); - MEM_FREE(variable_ptr->name_ptr); - if (variable_ptr->type == VALUE_TYPE_STR) { - MEM_FREE(variable_ptr->value.ptr); - } - MEM_FREE(variable_ptr); - return NULL; - } - return variable_ptr; -#endif -} -void cmd_variable_add_int(char *variable, int value) -{ - cmd_variable_t *variable_ptr = cmd_variable_add_prepare(variable, " "); - if (variable_ptr == NULL) { - return; - } - if (variable_ptr->value.ptr != NULL && - variable_ptr->type == VALUE_TYPE_STR) { - // free memory - MEM_FREE(variable_ptr->value.ptr); - } - variable_ptr->type = VALUE_TYPE_INT; - variable_ptr->value.i = value; -} -void cmd_variable_add(char *variable, char *value) -{ - cmd_variable_t *variable_ptr = cmd_variable_add_prepare(variable, value); - if (variable_ptr == NULL) { - return; - } - int value_len = strlen(value); - replace_string(value, value_len, "\\n", "\n"); - replace_string(value, value_len, "\\r", "\r"); - - // add new or modify - int new_len = strlen(value) + 1; - int old_len = 0; - if (variable_ptr->value.ptr != NULL && - variable_ptr->type == VALUE_TYPE_STR) { - // free memory if required - old_len = strlen(variable_ptr->value.ptr) + 1; - if (old_len != new_len) { - MEM_FREE(variable_ptr->value.ptr); - } - } - if (old_len != new_len) { - variable_ptr->value.ptr = (char *)MEM_ALLOC(new_len); - if (variable_ptr->value.ptr == NULL) { - cmd_variable_add(variable, NULL); - tr_error("Mem alloc failed cmd_variable_add value_ptr"); - return; - } - } - variable_ptr->type = VALUE_TYPE_STR; - strcpy(variable_ptr->value.ptr, value); - return; -} - -static bool is_cmdline_commands(char *command) -{ - if ((strncmp(command, "alias", 5) == 0) || - (strcmp(command, "echo") == 0) || - (strcmp(command, "set") == 0) || - (strcmp(command, "clear") == 0) || - (strcmp(command, "help") == 0)) { - return true; - } - return false; -} -/*Basic commands for cmd line - * alias - * echo - * set - * clear - * help - */ -int alias_command(int argc, char *argv[]) -{ - if (argc == 1) { - // print all alias - cmd_printf("alias:\r\n"); - cmd_alias_print_all(); - } else if (argc == 2) { - // print alias - if (is_cmdline_commands(argv[1])) { - cmd_printf("Cannot overwrite default commands with alias\r\n"); - return -1; - } - tr_debug("Deleting alias %s", argv[1]); - cmd_alias_add(argv[1], NULL); - } else { - // set alias - tr_debug("Setting alias %s = %s", argv[1], argv[2]); - cmd_alias_add(argv[1], argv[2]); - } - return 0; -} -int unset_command(int argc, char *argv[]) -{ - if (argc != 2) { - return CMDLINE_RETCODE_INVALID_PARAMETERS; - } - tr_debug("Deleting variable %s", argv[1]); - cmd_variable_add(argv[1], NULL); - return 0; -} -#if MBED_CONF_CMDLINE_USE_DUMMY_SET_ECHO_COMMANDS == 1 -int echo_command(int argc, char *argv[]) -{ - (void)argc; - (void)argv; - return 0; -} -int set_command(int argc, char *argv[]) -{ - (void)argc; - (void)argv; - return 0; -} -#else -int set_command(int argc, char *argv[]) -{ - if (argc == 1) { - // print all alias - cmd_printf("variables:\r\n"); - cmd_variable_print_all(); - } else if (argc == 2) { - char *separator_ptr = strchr(argv[1], '='); - if (!separator_ptr) { - return CMDLINE_RETCODE_INVALID_PARAMETERS; - } - *separator_ptr = 0; - cmd_variable_add(argv[1], separator_ptr + 1); - } else { - // set alias - tr_debug("Setting variable %s = %s", argv[1], argv[2]); - //handle special cases: vt100 on|off - bool state; -#if MBED_CONF_CMDLINE_ENABLE_ESCAPE_HANDLING == 1 - if (cmd_parameter_bool(argc, argv, "--vt100", &state)) { - cmd.vt100_on = state; - return 0; - } -#endif - if (cmd_parameter_bool(argc, argv, "--retcode", &state)) { - cmd_variable_add(VAR_RETFMT, state ? DEFAULT_RETFMT : NULL); - return 0; - } - char *str; - if (cmd_parameter_val(argc, argv, "--retfmt", &str)) { - cmd_variable_add(VAR_RETFMT, str); - return 0; - } - cmd_variable_add(argv[1], argv[2]); - } - return 0; -} -int echo_command(int argc, char *argv[]) -{ - bool printEcho = false; - if (argc == 1) { - printEcho = true; - } else if (argc == 2) { - if (strcmp(argv[1], "off") == 0) { - cmd_echo(false); - printEcho = true; - } else if (strcmp(argv[1], "on") == 0) { - cmd_echo(true); - printEcho = true; - } - } - if (printEcho) { - cmd_printf("ECHO is %s\r\n", cmd.echo ? "on" : "off"); - } else { - for (int n = 1; n < argc; n++) { - tr_deep("ECHO: %s\r\n", argv[n]); - cmd_printf("%s ", argv[n]); - } - cmd_printf("\r\n"); - } - return 0; -} -#endif -int clear_command(int argc, char *argv[]) -{ - (void)argc; - (void)argv; - cmd_echo(true); - cmd_init_screen(); - return 0; -} -int help_command(int argc, char *argv[]) -{ - cmd_printf("Commands:\r\n"); - if (argc == 1) { - ns_list_foreach(cmd_command_t, cur_ptr, &cmd.command_list) { - cmd_printf("%-16s%s\r\n", cur_ptr->name_ptr, (cur_ptr->info_ptr ? cur_ptr->info_ptr : "")); - } - } else if (argc == 2) { - cmd_command_t *cmd_ptr = cmd_find(argv[1]); - if (cmd_ptr) { - cmd_printf("Command: %s\r\n", cmd_ptr->name_ptr); - if (cmd_ptr->man_ptr) { - cmd_printf("%s\r\n", cmd_ptr->man_ptr); - } else if (cmd_ptr->info_ptr) { - cmd_printf("%s\r\n", cmd_ptr->info_ptr); - } - } else { - cmd_printf("Command '%s' not found", argv[1]); - } - } - return 0; -} -int true_command(int argc, char *argv[]) -{ - (void)argc; - (void)argv; - return CMDLINE_RETCODE_SUCCESS; -} -int false_command(int argc, char *argv[]) -{ - (void)argc; - (void)argv; - return CMDLINE_RETCODE_FAIL; -} -int history_command(int argc, char *argv[]) -{ -#if MBED_CONF_CMDLINE_ENABLE_HISTORY - if (argc == 1) { - int history_size = (int)ns_list_count(&cmd.history_list); - cmd_printf("History [%i/%i]:\r\n", history_size - 1, cmd.history_max_count - 1); - int i = 0; - ns_list_foreach_reverse(cmd_history_t, cur_ptr, &cmd.history_list) { - if (i != history_size - 1) { - cmd_printf("[%i]: %s\r\n", i++, cur_ptr->command_ptr); - } - } - } else if (argc == 2) { - if (strcmp(argv[1], "clear") == 0) { - cmd_history_clean(); - } else { - cmd_history_size(strtoul(argv[1], 0, 10)); - } - } -#else - (void)argc; - (void)argv; -#endif - return 0; -} - -/** Parameter helping functions - */ -int cmd_parameter_index(int argc, char *argv[], const char *key) -{ - int i = 0; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], key) == 0) { - return i; - } - } - return -1; -} -bool cmd_has_option(int argc, char *argv[], const char *key) -{ - int i = 0; - for (i = 1; i < argc; i++) { - if (argv[i][0] == '-' && argv[i][1] != '-') { - if (strstr(argv[i], key) != 0) { - return true; - } - } - } - return false; -} -bool cmd_parameter_bool(int argc, char *argv[], const char *key, bool *value) -{ - int i = cmd_parameter_index(argc, argv, key); - if (i > 0) { - if (argc > (i + 1)) { - if (strcmp(argv[i + 1], "on") == 0 || - strcmp(argv[i + 1], "1") == 0 || - strcmp(argv[i + 1], "true") == 0 || - strcmp(argv[i + 1], "enable") == 0 || - strcmp(argv[i + 1], "allow") == 0) { - *value = true; - } else { - *value = false; - } - return true; - } - } - return false; -} -bool cmd_parameter_val(int argc, char *argv[], const char *key, char **value) -{ - int i = cmd_parameter_index(argc, argv, key); - if (i > 0) { - if (argc > (i + 1)) { - *value = argv[i + 1]; - return true; - } - } - return false; -} -bool cmd_parameter_int(int argc, char *argv[], const char *key, int32_t *value) -{ - int i = cmd_parameter_index(argc, argv, key); - char *tailptr; - if (i > 0) { - if (argc > (i + 1)) { - *value = strtol(argv[i + 1], &tailptr, 10); - if (0 == *tailptr) { - return true; - } - if (!isspace((unsigned char) *tailptr)) { - return false; - } else { - return true; - } - } - } - return false; -} -bool cmd_parameter_float(int argc, char *argv[], const char *key, float *value) -{ - int i = cmd_parameter_index(argc, argv, key); - char *tailptr; - if (i > 0) { - if (argc > (i + 1)) { - *value = strtof(argv[i + 1], &tailptr); - if (0 == *tailptr) { - return true; //Should be correct read always - } - if (!isspace((unsigned char) *tailptr)) { - return false; //Garbage in tailptr - } else { - return true; //Spaces are fine after float - } - } - } - return false; -} -// convert hex string (eg. "76 ab ff") to binary array -static int string_to_bytes(const char *str, uint8_t *buf, int bytes) -{ - int len = strlen(str); - if (len <= (3 * bytes - 1)) { - int i; - for (i = 0; i < bytes; i++) { - if (i * 3 < len) { - buf[i] = (uint8_t)strtoul(str + i * 3, 0, 16); - } else { - buf[i] = 0; - } - } - return 0; - } - return -1; -} - -static uint64_t read_64_bit(const uint8_t data_buf[__static 8]) -{ - uint64_t temp_64; - temp_64 = (uint64_t)(*data_buf++) << 56; - temp_64 += (uint64_t)(*data_buf++) << 48; - temp_64 += (uint64_t)(*data_buf++) << 40; - temp_64 += (uint64_t)(*data_buf++) << 32; - temp_64 += (uint64_t)(*data_buf++) << 24; - temp_64 += (uint64_t)(*data_buf++) << 16; - temp_64 += (uint64_t)(*data_buf++) << 8; - temp_64 += *data_buf++; - return temp_64; -} - -bool cmd_parameter_timestamp(int argc, char *argv[], const char *key, int64_t *value) -{ - int i = cmd_parameter_index(argc, argv, key); - if (i > 0) { - if (argc > (i + 1)) { - if (strchr(argv[i + 1], ',') != 0) { - // Format seconds,tics - const char splitValue[] = ", "; - char *token; - token = strtok(argv[i + 1], splitValue); - if (token) { - *value = (int64_t)strtoul(token, 0, 10) << 16; - } - token = strtok(NULL, splitValue); - if (token) { - *value |= (0xffff & strtoul(token, 0, 10)); - } - } else if (strchr(argv[i + 1], ':') != 0) { - // Format 00:00:00:00:00:00:00:00 - uint8_t buf[8]; - if (strlen(argv[i + 1]) == 23 && - string_to_bytes(argv[i + 1], buf, 8) == 0) { - *value = read_64_bit(buf); - } else { - cmd_printf("timestamp should be 8 bytes long\r\n"); - return false; - } - } else { - // Format uint64 - *value = strtol(argv[i + 1], 0, 10); - } - return true; - } - } - return false; -} -char *cmd_parameter_last(int argc, char *argv[]) -{ - if (argc > 1) { - return argv[ argc - 1 ]; - } - return NULL; -} -/** - * find last space but ignore nulls and first spaces. - * used only internally to find out previous word - * e.g. - * const char str[] = "aaaab aa bbb\0\0"; - * const char* tmp = last_space(str+strlen(str), str); - * printf(tmp); // prints "bbb" - */ -static const char *find_last_space(const char *from, const char *to) -{ - if (from <= to) { - return 0; - } - while ((from > to) && ((*from == 0) || (*from == ' '))) { - from--; - } - while (from > to) { - if (*from == ' ') { - return from + 1; - } - from--; - } - return 0; -} -static int replace_string( - char *str, int str_len, - const char *old_str, const char *new_str) -{ - char *ptr = str; - char *end = str + str_len; - int old_len = strlen(old_str); - int new_len = strlen(new_str); - if (old_len > 0) { - tr_deep("find: '%s'\r\n", old_str); - while ((ptr = strstr(ptr, old_str)) != 0) { - if (ptr + new_len > end) { - tr_warn("Buffer was not enough for replacing\r\n"); - return 1; - } - tr_warn("old_str found\r\n"); - if (old_len != new_len) { - tr_warn("memmove\r\n"); - memmove(ptr + new_len, ptr + old_len, strlen(ptr + old_len) + 1); - } - memcpy(ptr, new_str, new_len); - ptr += new_len; - } - } - return 0; -} diff --git a/platform/mbed_lib.json b/platform/mbed_lib.json index 33d9dbaaf9a..1a7bc0ffd7b 100644 --- a/platform/mbed_lib.json +++ b/platform/mbed_lib.json @@ -125,7 +125,7 @@ "value": true }, - "cthunk_count_max": { + "cthunk-count-max": { "help": "The maximum CThunk objects used at the same time. This must be greater than 0 and less 256", "value": 8 }, diff --git a/storage/blockdevice/COMPONENT_DATAFLASH/mbed_lib.json b/storage/blockdevice/COMPONENT_DATAFLASH/mbed_lib.json index 54b5dc519b9..3c726c653d7 100644 --- a/storage/blockdevice/COMPONENT_DATAFLASH/mbed_lib.json +++ b/storage/blockdevice/COMPONENT_DATAFLASH/mbed_lib.json @@ -1,11 +1,11 @@ { "name": "dataflash", "config": { - "SPI_MOSI": "SPI_MOSI", - "SPI_MISO": "SPI_MISO", - "SPI_CLK": "SPI_SCK", - "SPI_CS": "SPI_CS", - "SPI_FREQ": "40000000", + "spi-mosi": "SPI_MOSI", + "spi-miso": "SPI_MISO", + "spi-clk": "SPI_SCK", + "spi-cs": "SPI_CS", + "spi-freq": "40000000", "binary-size": { "help": "Configure device to use binary address space.", "value": "0" diff --git a/storage/blockdevice/COMPONENT_OSPIF/mbed_lib.json b/storage/blockdevice/COMPONENT_OSPIF/mbed_lib.json index 27f2b429eaf..04a99481ff0 100644 --- a/storage/blockdevice/COMPONENT_OSPIF/mbed_lib.json +++ b/storage/blockdevice/COMPONENT_OSPIF/mbed_lib.json @@ -9,38 +9,38 @@ "help": "(Legacy SFDP 1.0 ONLY) Reset involves a single command (0xF0)", "value": false }, - "OSPI_IO0": "MBED_CONF_DRIVERS_OSPI_IO0", - "OSPI_IO1": "MBED_CONF_DRIVERS_OSPI_IO1", - "OSPI_IO2": "MBED_CONF_DRIVERS_OSPI_IO2", - "OSPI_IO3": "MBED_CONF_DRIVERS_OSPI_IO3", - "OSPI_IO4": "MBED_CONF_DRIVERS_OSPI_IO4", - "OSPI_IO5": "MBED_CONF_DRIVERS_OSPI_IO5", - "OSPI_IO6": "MBED_CONF_DRIVERS_OSPI_IO6", - "OSPI_IO7": "MBED_CONF_DRIVERS_OSPI_IO7", - "OSPI_SCK": "MBED_CONF_DRIVERS_OSPI_SCK", - "OSPI_CSN": "MBED_CONF_DRIVERS_OSPI_CSN", - "OSPI_DQS": "MBED_CONF_DRIVERS_OSPI_DQS", - "OSPI_POLARITY_MODE": 0, - "OSPI_FREQ": "40000000", - "OSPI_MIN_READ_SIZE": "1", - "OSPI_MIN_PROG_SIZE": "1" + "ospi-io0": "MBED_CONF_DRIVERS_OSPI_IO0", + "ospi-io1": "MBED_CONF_DRIVERS_OSPI_IO1", + "ospi-io2": "MBED_CONF_DRIVERS_OSPI_IO2", + "ospi-io3": "MBED_CONF_DRIVERS_OSPI_IO3", + "ospi-io4": "MBED_CONF_DRIVERS_OSPI_IO4", + "ospi-io5": "MBED_CONF_DRIVERS_OSPI_IO5", + "ospi-io6": "MBED_CONF_DRIVERS_OSPI_IO6", + "ospi-io7": "MBED_CONF_DRIVERS_OSPI_IO7", + "ospi-sck": "MBED_CONF_DRIVERS_OSPI_SCK", + "ospi-csn": "MBED_CONF_DRIVERS_OSPI_CSN", + "ospi-dqs": "MBED_CONF_DRIVERS_OSPI_DQS", + "ospi-polarity-mode": 0, + "ospi-freq": "40000000", + "ospi-min-read-size": "1", + "ospi-min-prog-size": "1" }, "target_overrides": { "MX25LM51245G": { - "OSPI_FREQ": "66000000" + "ospi-freq": "66000000" }, "B_U585_IOT02A": { - "OSPI_IO0": "PF_0", - "OSPI_IO1": "PF_1", - "OSPI_IO2": "PF_2", - "OSPI_IO3": "PF_3", - "OSPI_IO4": "PH_9", - "OSPI_IO5": "PH_10", - "OSPI_IO6": "PH_11", - "OSPI_IO7": "PH_12", - "OSPI_SCK": "PF_4", - "OSPI_CSN": "PI_5", - "OSPI_DQS": "PF_12" + "ospi-io0": "PF_0", + "ospi-io1": "PF_1", + "ospi-io2": "PF_2", + "ospi-io3": "PF_3", + "ospi-io4": "PH_9", + "ospi-io5": "PH_10", + "ospi-io6": "PH_11", + "ospi-io7": "PH_12", + "ospi-sck": "PF_4", + "ospi-csn": "PI_5", + "ospi-dqs": "PF_12" } } } diff --git a/storage/blockdevice/COMPONENT_QSPIF/mbed_lib.json5 b/storage/blockdevice/COMPONENT_QSPIF/mbed_lib.json5 index 484cf77b702..f99897352ea 100644 --- a/storage/blockdevice/COMPONENT_QSPIF/mbed_lib.json5 +++ b/storage/blockdevice/COMPONENT_QSPIF/mbed_lib.json5 @@ -9,54 +9,54 @@ "help": "(Legacy SFDP 1.0 ONLY) Reset involves a single command (0xF0)", "value": false }, - "QSPI_IO0": "MBED_CONF_DRIVERS_QSPI_IO0", - "QSPI_IO1": "MBED_CONF_DRIVERS_QSPI_IO1", - "QSPI_IO2": "MBED_CONF_DRIVERS_QSPI_IO2", - "QSPI_IO3": "MBED_CONF_DRIVERS_QSPI_IO3", - "QSPI_SCK": "MBED_CONF_DRIVERS_QSPI_SCK", - "QSPI_CSN": "MBED_CONF_DRIVERS_QSPI_CSN", - "QSPI_POLARITY_MODE": 0, - "QSPI_FREQ": "40000000", - "QSPI_MIN_READ_SIZE": "1", - "QSPI_MIN_PROG_SIZE": "1", - "QSPI_MACRONIX_NUM_STATUS_REGISTER": { + "qspi-io0": "MBED_CONF_DRIVERS_QSPI_IO0", + "qspi-io1": "MBED_CONF_DRIVERS_QSPI_IO1", + "qspi-io2": "MBED_CONF_DRIVERS_QSPI_IO2", + "qspi-io3": "MBED_CONF_DRIVERS_QSPI_IO3", + "qspi-sck": "MBED_CONF_DRIVERS_QSPI_SCK", + "qspi-csn": "MBED_CONF_DRIVERS_QSPI_CSN", + "qspi-polarity-mode": 0, + "qspi-freq": "40000000", + "qspi-min-read-size": "1", + "qspi-min-prog-size": "1", + "qspi-macronix-num-status-register": { "help": "For most of Macronix QSPI flashes, they only have 2 status registers. However, some, e.g. MX25R6435F, have 3. This option can be used to control how many status registers the flash is assumed to have.", "value": "2" } }, "target_overrides": { "MX25R6435F": { - "QSPI_FREQ": "8000000", - "QSPI_MACRONIX_NUM_STATUS_REGISTER":"3" + "qspi-freq": "8000000", + "qspi-macronix-num-status-register":"3" }, "MX25L51245G": { - "QSPI_FREQ": "8000000" + "qspi-freq": "8000000" }, "MX25LM51245G": { - "QSPI_FREQ": "66000000" + "qspi-freq": "66000000" }, "N25Q128A": { - "QSPI_FREQ": "80000000", + "qspi-freq": "80000000", "enable-and-reset": true }, "MCU_NRF52840": { - "QSPI_FREQ": "32000000", - "QSPI_MIN_READ_SIZE": "4", - "QSPI_MIN_PROG_SIZE": "4" + "qspi-freq": "32000000", + "qspi-min-read-size": "4", + "qspi-min-prog-size": "4" }, "MCU_PSOC6": { - "QSPI_FREQ": "50000000" + "qspi-freq": "50000000" }, "EFM32GG11_STK3701": { - "QSPI_MIN_READ_SIZE": "4", - "QSPI_MIN_PROG_SIZE": "4" + "qspi-min-read-size": "4", + "qspi-min-prog-size": "4" }, "MCU_LPC546XX": { - "QSPI_MIN_READ_SIZE": "4", - "QSPI_MIN_PROG_SIZE": "4" + "qspi-min-read-size": "4", + "qspi-min-prog-size": "4" }, "ARDUINO_GIGA": { - "QSPI_POLARITY_MODE": "QSPIF_POLARITY_MODE_1", + "qspi-polarity-mode": "QSPIF_POLARITY_MODE_1", // The flash on this board (AT25SF128A) is quite old and does not have reset information in its // SFDP table. "enable-and-reset": true diff --git a/storage/blockdevice/COMPONENT_SD/mbed_lib.json b/storage/blockdevice/COMPONENT_SD/mbed_lib.json index 3cfafb47a25..c26bbe8806b 100644 --- a/storage/blockdevice/COMPONENT_SD/mbed_lib.json +++ b/storage/blockdevice/COMPONENT_SD/mbed_lib.json @@ -1,138 +1,138 @@ { "name": "sd", "config": { - "SPI_CS": "ARDUINO_UNO_SPI_CS", - "SPI_MOSI": "ARDUINO_UNO_SPI_MOSI", - "SPI_MISO": "ARDUINO_UNO_SPI_MISO", - "SPI_CLK": "ARDUINO_UNO_SPI_SCK", - "FSFAT_SDCARD_INSTALLED": 1, - "CMD_TIMEOUT": 10000, - "CMD0_IDLE_STATE_RETRIES": 5, - "INIT_FREQUENCY": 100000, - "TRX_FREQUENCY": 1000000, - "CRC_ENABLED": 0, - "TEST_BUFFER": 8192 + "spi-cs": "ARDUINO_UNO_SPI_CS", + "spi-mosi": "ARDUINO_UNO_SPI_MOSI", + "spi-miso": "ARDUINO_UNO_SPI_MISO", + "spi-clk": "ARDUINO_UNO_SPI_SCK", + "fsfat-sdcard-installed": 1, + "cmd-timeout": 10000, + "cmd0-idle-state-retries": 5, + "init-frequency": 100000, + "trx-frequency": 1000000, + "crc-enabled": 0, + "test-buffer": 8192 }, "target_overrides": { "NUCLEO_F070RB": { - "TEST_BUFFER": 4096 + "test-buffer": 4096 }, "NUCLEO_F072RB": { - "TEST_BUFFER": 4096 + "test-buffer": 4096 }, "NUCLEO_F103RB": { - "TEST_BUFFER": 4096 + "test-buffer": 4096 }, "NUCLEO_L073RZ": { - "TEST_BUFFER": 4096 + "test-buffer": 4096 }, "DISCO_L072CZ_LRWAN1": { - "TEST_BUFFER": 4096 + "test-buffer": 4096 }, "NUCLEO_F091RC": { - "TEST_BUFFER": 4096 + "test-buffer": 4096 }, "KL22F": { - "SPI_MOSI": "PTD6", - "SPI_MISO": "PTD7", - "SPI_CLK": "PTD5", - "SPI_CS": "PTD4" + "spi-mosi": "PTD6", + "spi-miso": "PTD7", + "spi-clk": "PTD5", + "spi-cs": "PTD4" }, "KL25Z": { - "SPI_MOSI": "PTD2", - "SPI_MISO": "PTD3", - "SPI_CLK": "PTD1", - "SPI_CS": "PTD0" + "spi-mosi": "PTD2", + "spi-miso": "PTD3", + "spi-clk": "PTD1", + "spi-cs": "PTD0" }, "KL43Z": { - "SPI_MOSI": "PTD6", - "SPI_MISO": "PTD7", - "SPI_CLK": "PTD5", - "SPI_CS": "PTD4" + "spi-mosi": "PTD6", + "spi-miso": "PTD7", + "spi-clk": "PTD5", + "spi-cs": "PTD4" }, "KL46Z": { - "SPI_MOSI": "PTD6", - "SPI_MISO": "PTD7", - "SPI_CLK": "PTD5", - "SPI_CS": "PTD4" + "spi-mosi": "PTD6", + "spi-miso": "PTD7", + "spi-clk": "PTD5", + "spi-cs": "PTD4" }, "K64F": { - "SPI_CS": "PTE4", - "SPI_MOSI": "PTE3", - "SPI_MISO": "PTE1", - "SPI_CLK": "PTE2" + "spi-cs": "PTE4", + "spi-mosi": "PTE3", + "spi-miso": "PTE1", + "spi-clk": "PTE2" }, "K66F": { - "SPI_MOSI": "PTE3", - "SPI_MISO": "PTE1", - "SPI_CLK": "PTE2", - "SPI_CS": "PTE4" + "spi-mosi": "PTE3", + "spi-miso": "PTE1", + "spi-clk": "PTE2", + "spi-cs": "PTE4" }, "LPC2368": { - "SPI_MOSI": "p11", - "SPI_MISO": "p12", - "SPI_CLK": "p13", - "SPI_CS": "p14" + "spi-mosi": "p11", + "spi-miso": "p12", + "spi-clk": "p13", + "spi-cs": "p14" }, "MAX32630FTHR": { - "SPI_MOSI": "P0_5", - "SPI_MISO": "P0_6", - "SPI_CLK": "P0_4", - "SPI_CS": "P0_7" + "spi-mosi": "P0_5", + "spi-miso": "P0_6", + "spi-clk": "P0_4", + "spi-cs": "P0_7" }, "NUMAKER_PFM_M453": { - "SPI_MOSI": "PD_13", - "SPI_MISO": "PD_14", - "SPI_CLK": "PD_15", - "SPI_CS": "PD_12" + "spi-mosi": "PD_13", + "spi-miso": "PD_14", + "spi-clk": "PD_15", + "spi-cs": "PD_12" }, "NUMAKER_PFM_NUC472": { - "SPI_MOSI": "PF_0", - "SPI_MISO": "PD_15", - "SPI_CLK": "PD_14", - "SPI_CS": "PD_13" + "spi-mosi": "PF_0", + "spi-miso": "PD_15", + "spi-clk": "PD_14", + "spi-cs": "PD_13" }, "RZ_A1H": { - "SPI_MOSI": "P8_5", - "SPI_MISO": "P8_6", - "SPI_CLK": "P8_3", - "SPI_CS": "P8_4" + "spi-mosi": "P8_5", + "spi-miso": "P8_6", + "spi-clk": "P8_3", + "spi-cs": "P8_4" }, "GR_LYCHEE": { - "SPI_MOSI": "P5_6", - "SPI_MISO": "P5_7", - "SPI_CLK": "P5_4", - "SPI_CS": "P5_5" + "spi-mosi": "P5_6", + "spi-miso": "P5_7", + "spi-clk": "P5_4", + "spi-cs": "P5_5" }, "HEXIWEAR": { - "SPI_MOSI": "PTE3", - "SPI_MISO": "PTE1", - "SPI_CLK": "PTE2", - "SPI_CS": "PTE4" + "spi-mosi": "PTE3", + "spi-miso": "PTE1", + "spi-clk": "PTE2", + "spi-cs": "PTE4" }, "TB_SENSE_12": { - "SPI_MOSI": "PC6", - "SPI_MISO": "PC7", - "SPI_CLK": "PC8", - "SPI_CS": "PC9" + "spi-mosi": "PC6", + "spi-miso": "PC7", + "spi-clk": "PC8", + "spi-cs": "PC9" }, "LPC1768": { - "SPI_MOSI": "p5", - "SPI_MISO": "p6", - "SPI_CLK": "p7", - "SPI_CS": "p8" + "spi-mosi": "p5", + "spi-miso": "p6", + "spi-clk": "p7", + "spi-cs": "p8" }, "ARCH_MAX": { - "SPI_MOSI": "PC_3", - "SPI_MISO": "PC_2", - "SPI_CLK": "PB_10", - "SPI_CS": "PE_2" + "spi-mosi": "PC_3", + "spi-miso": "PC_2", + "spi-clk": "PB_10", + "spi-cs": "PE_2" }, "WIO_BG96": { - "SPI_CS": "SPI_CS", - "SPI_MOSI": "SPI_MOSI", - "SPI_MISO": "SPI_MISO", - "SPI_CLK": "SPI_SCK" + "spi-cs": "SPI_CS", + "spi-mosi": "SPI_MOSI", + "spi-miso": "SPI_MISO", + "spi-clk": "SPI_SCK" } } } diff --git a/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json b/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json index b1ee6f388a9..d3d7d64937b 100644 --- a/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json +++ b/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json @@ -1,11 +1,11 @@ { "name": "spif-driver", "config": { - "SPI_MOSI": "SPI_MOSI", - "SPI_MISO": "SPI_MISO", - "SPI_CLK": "SPI_SCK", - "SPI_CS": "SPI_CS", - "SPI_FREQ": "40000000", + "spi-mosi": "SPI_MOSI", + "spi-miso": "SPI_MISO", + "spi-clk": "SPI_SCK", + "spi-cs": "SPI_CS", + "spi-freq": "40000000", "debug": { "help": "Enable debug logs. [0/1]", "accepted_values" : [0, 1], @@ -14,68 +14,68 @@ }, "target_overrides": { "HANI_IOT": { - "SPI_MOSI": "P0_26", - "SPI_MISO": "P1_3", - "SPI_CLK": "P1_2", - "SPI_CS": "P0_20" + "spi-mosi": "P0_26", + "spi-miso": "P1_3", + "spi-clk": "P1_2", + "spi-cs": "P0_20" }, "LPC54114": { - "SPI_MOSI": "P0_20", - "SPI_MISO": "P0_18", - "SPI_CLK": "P0_19", - "SPI_CS": "P1_2" + "spi-mosi": "P0_20", + "spi-miso": "P0_18", + "spi-clk": "P0_19", + "spi-cs": "P1_2" }, "NRF52840_DK": { - "SPI_MOSI": "p20", - "SPI_MISO": "p21", - "SPI_CLK": "p19", - "SPI_CS": "p17" + "spi-mosi": "p20", + "spi-miso": "p21", + "spi-clk": "p19", + "spi-cs": "p17" }, "HEXIWEAR": { - "SPI_MOSI": "PTD6", - "SPI_MISO": "PTD7", - "SPI_CLK": "PTD5", - "SPI_CS": "PTD4" + "spi-mosi": "PTD6", + "spi-miso": "PTD7", + "spi-clk": "PTD5", + "spi-cs": "PTD4" }, "WIO_EMW3166": { - "SPI_MOSI": "PB_15", - "SPI_MISO": "PB_14", - "SPI_CLK": "PB_13", - "SPI_CS": "PA_10" + "spi-mosi": "PB_15", + "spi-miso": "PB_14", + "spi-clk": "PB_13", + "spi-cs": "PA_10" }, "ADV_WISE_1570": { - "SPI_MOSI": "PA_7", - "SPI_MISO": "PA_6", - "SPI_CLK": "PA_5", - "SPI_CS": "PB_12", - "SPI_FREQ": "20000000" + "spi-mosi": "PA_7", + "spi-miso": "PA_6", + "spi-clk": "PA_5", + "spi-cs": "PB_12", + "spi-freq": "20000000" }, "UHURU_RAVEN": { - "SPI_MOSI": "PE_14", - "SPI_MISO": "PE_13", - "SPI_CLK": "PE_12", - "SPI_CS": "PE_11" + "spi-mosi": "PE_14", + "spi-miso": "PE_13", + "spi-clk": "PE_12", + "spi-cs": "PE_11" }, "MTS_DRAGONFLY_F411RE": { - "SPI_MOSI": "SPI3_MOSI", - "SPI_MISO": "SPI3_MISO", - "SPI_CLK": "SPI3_SCK", - "SPI_CS": "SPI_CS1" + "spi-mosi": "SPI3_MOSI", + "spi-miso": "SPI3_MISO", + "spi-clk": "SPI3_SCK", + "spi-cs": "SPI_CS1" }, "MTS_DRAGONFLY_F413RH": { - "SPI_MOSI": "SPI3_MOSI", - "SPI_MISO": "SPI3_MISO", - "SPI_CLK": "SPI3_SCK", - "SPI_CS": "SPI_CS1" + "spi-mosi": "SPI3_MOSI", + "spi-miso": "SPI3_MISO", + "spi-clk": "SPI3_SCK", + "spi-cs": "SPI_CS1" }, "ARDUINO_NICLA_SENSE_ME": { - "SPI_CS": "CS_FLASH" + "spi-cs": "CS_FLASH" }, "NUMAKER_PFM_M487": { - "SPI_MOSI": "PC_0", - "SPI_MISO": "PC_1", - "SPI_CLK": "PC_2", - "SPI_CS": "PC_3" + "spi-mosi": "PC_0", + "spi-miso": "PC_1", + "spi-clk": "PC_2", + "spi-cs": "PC_3" } } } diff --git a/storage/filesystem/fat/ChaN/mbed_lib.json b/storage/filesystem/fat/ChaN/mbed_lib.json index 28bc72fa87b..4953c7d9e04 100644 --- a/storage/filesystem/fat/ChaN/mbed_lib.json +++ b/storage/filesystem/fat/ChaN/mbed_lib.json @@ -1,171 +1,171 @@ { - "name": "fat_chan", + "name": "fat-chan", "config": { - "ffs_dbg": { + "ffs-dbg": { "help": "Switches debug mode. 0: disable, 1: enable.", "value": "0" }, - "ff_fs_readonly": { + "ff-fs-readonly": { "help": "Switches read-only configuration. 0: read/write, 1: read-only.", "value": "0" }, - "ff_fs_minimize": { + "ff-fs-minimize": { "help": "Defines minimization level to remove some basic API functions. 0: all functions enabled, 1: f_stat() removed, 2: f_opendir() removed in addition to 1, 3: f_lseek() removed in addition to 2.", "value": "0" }, - "ff_use_strfunc": { + "ff-use-strfunc": { "help": "Switches string functions. 0: disable string functions, 1: enable without LF-CRLF conversion, 2: enable with LF-CRLF conversion.", "value": "0" }, - "ff_print_lli": { + "ff-print-lli": { "help": "Support f_printf() long long argument. 0: disable, 1: enable.", "value": "0" }, - "ff_print_float": { + "ff-print-float": { "help": "Support f_printf() floating point argument. 0: disable, 1: enable with '.' as decimal separator, 2: enable with ',' as decimal separator.", "value": "0" }, - "ff_strf_encode": { + "ff-strf-encode": { "help": "When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions convert the character encoding in it. This option selects assumption of character encoding ON THE FILE to be read/written via those functions. 0: ANSI/OEM in current CP, 1: unicode in UTF-16LE, 2: unicode in UTF-16BE, 3: unicode in UTF-8.", "value": "3" }, - "ff_use_find": { + "ff-use-find": { "help": "Switches filtered directory read functions. 0: disable, 1: enable, 2: enable with matching altname[] too.", "value": "0" }, - "ff_use_mkfs": { + "ff-use-mkfs": { "help": "Switches f_mkfs() function. 0: disable, 1: enable.", "value": "1" }, - "ff_use_fastseek": { + "ff-use-fastseek": { "help": "Switches fast seek function. 0: disable, 1: enable.", "value": "0" }, - "ff_use_expand": { + "ff-use-expand": { "help": "Switches f_expand function. 0: disable, 1: enable.", "value": "0" }, - "ff_use_chmod": { - "help": "Switches attribute manipulation functions. 0: disable, 1: enable. ff_fs_readonly needs to be 0 to enable this option.", + "ff-use-chmod": { + "help": "Switches attribute manipulation functions. 0: disable, 1: enable. ff-fs-readonly needs to be 0 to enable this option.", "value": "0" }, - "ff_use_label": { + "ff-use-label": { "help": "Switches volume label functions. 0: disable, 1: enable.", "value": "0" }, - "ff_use_forward": { + "ff-use-forward": { "help": "Switches f_forward() function. 0: disable, 1: enable.", "value": "0" }, - "ff_code_page": { + "ff-code-page": { "help": "Specifies the OEM code page to be used on the target system.", "value": "437" }, - "ff_use_lfn": { + "ff-use-lfn": { "help": "Switches the support for LFN (long file name). 0: disable LFN, 1: enable LFN with static working buffer on the BSS, always NOT thread-safe, 2: enable LFN with dynamic working buffer on the STACK, 3: enable LFN with dynamic working buffer on the HEAP.", "value": "3" }, - "ff_max_lfn": { + "ff-max-lfn": { "help": "Defines size of the working buffer in UTF-16 code unit and it can be in range of 12 to 255. It is recommended to be set 255 to fully support LFN specification.", "value": "255" }, - "ff_lfn_unicode": { + "ff-lfn-unicode": { "help": "Switches the character encoding on the API when LFN is enabled. 0: ANSI/OEM in current CP (TCHAR = char), 1: unicode in UTF-16 (TCHAR = WCHAR), 2: unicode in UTF-8 (TCHAR = char).", "value": "0" }, - "ff_lfn_buf": { + "ff-lfn-buf": { "help": "Defines size of file name members in the FILINFO structure which is used to read out directory items. The value should be suffcient for the file names to read. The maximum possible length of the read file name depends on character encoding. When LFN is not enabled, these options have no effect.", "value": "255" }, - "ff_sfn_buf": { - "help": "See ff_lfn_buf.", + "ff-sfn-buf": { + "help": "See ff-lfn-buf.", "value": "12" }, - "ff_fs_rpath": { + "ff-fs-rpath": { "help": "Configures support for relative path. 0: disable relative path and remove related functions, 1: enable relative path. f_chdir() and f_chdrive() are available, 2: f_getcwd() function is available in addition to 1.", "value": "1" }, - "ff_volumes": { + "ff-volumes": { "help": "Number of volumes (logical drives) to be used. (1-10).", "value": "4" }, - "ff_str_volume_id": { - "help": "Switches string support for volume ID. When ff_volume_strs is set to 1, also pre-defined strings can be used as drive number in the path name.", + "ff-str-volume-id": { + "help": "Switches string support for volume ID. When ff-volume-strs is set to 1, also pre-defined strings can be used as drive number in the path name.", "value": "0" }, - "ff_volume_strs": { - "help": "Defines the drive ID strings for each logical drive. Number of items must be equal to ff_volumes. Valid characters for the drive ID strings are: A-Z and 0-9.", + "ff-volume-strs": { + "help": "Defines the drive ID strings for each logical drive. Number of items must be equal to ff-volumes. Valid characters for the drive ID strings are: A-Z and 0-9.", "value": "\"RAM\",\"NAND\",\"CF\",\"SD\",\"SD2\",\"USB\",\"USB2\",\"USB3\"" }, - "ff_multi_partition": { + "ff-multi-partition": { "help": "Switches support for multiple volumes on the physical drive. By default (0), each logical drive number is bound to the same physical drive number and only an FAT volume found on the physical drive will be mounted. When this function is enabled (1), each logical drive number can be bound to arbitrary physical drive.", "value": "0" }, - "ff_min_ss": { + "ff-min-ss": { "help": "This and the next option configures the range of sector size to be supported. (512, 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and harddisk. But a larger value may be required for on-board flash memory and some type of optical media.", "value": "512" }, - "ff_max_ss": { - "help": "When ff_max_ss is larger than ff_min_ss, FatFs is configured for variable sector size mode.", + "ff-max-ss": { + "help": "When ff-max-ss is larger than ff-min-ss, FatFs is configured for variable sector size mode.", "value": "4096" }, - "ff_use_trim": { + "ff-use-trim": { "help": "Switches support for ATA-TRIM. 0: disable, 1: enable", "value": "1" }, - "ff_fs_nofsinfo": { + "ff-fs-nofsinfo": { "help": "If you need to know correct free space on the FAT32 volume, set bit 0 of this option, and f_getfree() function at first time after volume mount will force a full FAT scan. Bit 1 controls the use of last allocated cluster number.", "value": "0" }, - "ff_fs_tiny": { - "help": "Switches tiny buffer configuration. (0:Normal or 1:Tiny). At the tiny configuration, size of file object (FIL) is shrinked ff_max_ss bytes. Instead of private sector buffer eliminated from the file object, common sector buffer in the filesystem object (FATFS) is used for the file data transfer.", + "ff-fs-tiny": { + "help": "Switches tiny buffer configuration. (0:Normal or 1:Tiny). At the tiny configuration, size of file object (FIL) is shrinked ff-max-ss bytes. Instead of private sector buffer eliminated from the file object, common sector buffer in the filesystem object (FATFS) is used for the file data transfer.", "value": "1" }, - "ff_fs_exfat": { + "ff-fs-exfat": { "help": "Switches support for exFAT filesystem. 0: disable, 1: enable. When enable exFAT, also LFN needs to be enabled. Note that enabling exFAT discards ANSI C (C89) compatibility.", "value": "0" }, - "ff_fs_heapbuf": { + "ff-fs-heapbuf": { "help": "Enables the use of the heap for allocating buffers. Otherwise _max_ss sized buffers are allocated statically in relevant structures (in FATFS if _fs_tiny, otherwise in FATFS and FIL).", "value": "1" }, - "ff_fs_nortc": { - "help": "Switches timestamp functiton. If the system does not have any RTC function or valid timestamp is not needed, set to 1 to disable the timestamp function. All objects modified by FatFs will have a fixed timestamp defined by ff_nortc_mon, ff_nortc_mday and ff_nortc_year in local time.", + "ff-fs-nortc": { + "help": "Switches timestamp functiton. If the system does not have any RTC function or valid timestamp is not needed, set to 1 to disable the timestamp function. All objects modified by FatFs will have a fixed timestamp defined by ff-nortc-mon, ff-nortc-mday and ff-nortc-year in local time.", "value": "0" }, - "ff_nortc_mon": { - "help": "See ff_fs_nortc.", + "ff-nortc-mon": { + "help": "See ff-fs-nortc.", "value": "1" }, - "ff_nortc_mday": { - "help": "See ff_fs_nortc.", + "ff-nortc-mday": { + "help": "See ff-fs-nortc.", "value": "1" }, - "ff_nortc_year": { - "help": "See ff_fs_nortc.", + "ff-nortc-year": { + "help": "See ff-fs-nortc.", "value": "2017" }, - "ff_fs_lock": { - "help": "Switches file lock function to control duplicated file open and illegal operation to open objects. This option must be 0 when ff_fs_readonly is 1. The value defines how many files/sub-directories can be opened simultaneously under file lock control. Note that the file lock control is independent of re-entrancy.", + "ff-fs-lock": { + "help": "Switches file lock function to control duplicated file open and illegal operation to open objects. This option must be 0 when ff-fs-readonly is 1. The value defines how many files/sub-directories can be opened simultaneously under file lock control. Note that the file lock control is independent of re-entrancy.", "value": "0" }, - "ff_fs_reentrant": { - "help": "Switches the re-entrancy (thread safe) of the FatFs module itself. Note that regardless of this option, file access to different volume is always re-entrant and volume control functions. 0: disable re-entrancy. ff_fs_timeout and ff_sync_t have no effect. 1: enable re-entrancy. Also user provided synchronization handlers must be added to the project. Samples are available in option/syscall.c.", + "ff-fs-reentrant": { + "help": "Switches the re-entrancy (thread safe) of the FatFs module itself. Note that regardless of this option, file access to different volume is always re-entrant and volume control functions. 0: disable re-entrancy. ff-fs-timeout and ff-sync-t have no effect. 1: enable re-entrancy. Also user provided synchronization handlers must be added to the project. Samples are available in option/syscall.c.", "value": "0" }, - "ff_fs_timeout": { + "ff-fs-timeout": { "help": "Defines timeout period in unit of time tick.", "value": "1000" }, - "ff_sync_t": { + "ff-sync-t": { "help": "Defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT* and SemaphoreHandle_t.", "value": "HANDLE" }, - "flush_on_new_cluster": { + "flush-on-new-cluster": { "help": "Sync the file on every new cluster.", "value": "0" }, - "flush_on_new_sector": { + "flush-on-new-sector": { "help": "Sync the file on every new sector.", "value": "1" } diff --git a/storage/filesystem/littlefs/mbed_lib.json b/storage/filesystem/littlefs/mbed_lib.json index 2cbbe466b9d..5186958783c 100644 --- a/storage/filesystem/littlefs/mbed_lib.json +++ b/storage/filesystem/littlefs/mbed_lib.json @@ -1,17 +1,17 @@ { "name": "littlefs", "config": { - "read_size": { + "read-size": { "macro_name": "MBED_LFS_READ_SIZE", "value": 64, "help": "Minimum size of a block read. This determines the size of read buffers. This may be larger than the physical read size to improve performance by caching more of the block device." }, - "prog_size": { + "prog-size": { "macro_name": "MBED_LFS_PROG_SIZE", "value": 64, "help": "Minimum size of a block program. This determines the size of program buffers. This may be larger than the physical program size to improve performance by caching more of the block device." }, - "block_size": { + "block-size": { "macro_name": "MBED_LFS_BLOCK_SIZE", "value": 512, "help": "Size of an erasable block. This does not impact ram consumption and may be larger than the physical erase size. However, this should be kept small as each file currently takes up an entire block." @@ -26,27 +26,27 @@ "value": true, "help": "Enable intrinsics for bit operations such as ctz, popc, and le32 conversion. Can be disabled to help debug toolchain issues" }, - "enable_info": { + "enable-info": { "macro_name": "MBED_LFS_ENABLE_INFO", "value": false, "help": "Enables info logging, true = enabled, false = disabled, null = disabled only in release builds" }, - "enable_debug": { + "enable-debug": { "macro_name": "MBED_LFS_ENABLE_DEBUG", "value": null, "help": "Enables debug logging, true = enabled, false = disabled, null = disabled only in release builds" }, - "enable_warn": { + "enable-warn": { "macro_name": "MBED_LFS_ENABLE_WARN", "value": null, "help": "Enables warn logging, true = enabled, false = disabled, null = disabled only in release builds" }, - "enable_error": { + "enable-error": { "macro_name": "MBED_LFS_ENABLE_ERROR", "value": null, "help": "Enables error logging, true = enabled, false = disabled, null = disabled only in release builds" }, - "enable_assert": { + "enable-assert": { "macro_name": "MBED_LFS_ENABLE_ASSERT", "value": null, "help": "Enables asserts, true = enabled, false = disabled, null = disabled only in release builds" diff --git a/storage/filesystem/littlefsv2/mbed_lib.json b/storage/filesystem/littlefsv2/mbed_lib.json index 16b2c12d5a0..bf0ca65f294 100644 --- a/storage/filesystem/littlefsv2/mbed_lib.json +++ b/storage/filesystem/littlefsv2/mbed_lib.json @@ -1,22 +1,22 @@ { "name": "littlefs2", "config": { - "block_size": { + "block-size": { "macro_name": "MBED_LFS2_BLOCK_SIZE", "value": 512, "help": "Size of a logical block. This does not impact ram consumption and may be larger than the physical erase block. If the physical erase block is larger, littlefs will use that instead. Larger values will be faster but waste more storage when files are not aligned to a block size." }, - "block_cycles": { + "block-cycles": { "macro_name": "MBED_LFS2_BLOCK_CYCLES", "value": 1024, "help": "Number of erase cycles before a block is forcefully evicted. Larger values are more efficient but cause less even wear distribution. 0 disables dynamic wear-leveling." }, - "cache_size": { + "cache-size": { "macro_name": "MBED_LFS2_CACHE_SIZE", "value": "64", "help": "Size of read/program caches. Each file uses 1 cache, and littlefs allocates 2 caches for internal operations. Larger values should be faster but uses more RAM." }, - "lookahead_size": { + "lookahead-size": { "macro_name": "MBED_LFS2_LOOKAHEAD_SIZE", "value": 64, "help": "Size of the lookahead buffer. A larger lookahead reduces the allocation scans and results in a faster filesystem but uses more RAM." @@ -26,27 +26,27 @@ "value": true, "help": "Enable intrinsics for bit operations such as ctz, popc, and le32 conversion. Can be disabled to help debug toolchain issues" }, - "enable_info": { + "enable-info": { "macro_name": "MBED_LFS2_ENABLE_INFO", "value": false, "help": "Enables info logging, true = enabled, false = disabled, null = disabled only in release builds" }, - "enable_debug": { + "enable-debug": { "macro_name": "MBED_LFS2_ENABLE_DEBUG", "value": null, "help": "Enables debug logging, true = enabled, false = disabled, null = disabled only in release builds" }, - "enable_warn": { + "enable-warn": { "macro_name": "MBED_LFS2_ENABLE_WARN", "value": null, "help": "Enables warn logging, true = enabled, false = disabled, null = disabled only in release builds" }, - "enable_error": { + "enable-error": { "macro_name": "MBED_LFS2_ENABLE_ERROR", "value": null, "help": "Enables error logging, true = enabled, false = disabled, null = disabled only in release builds" }, - "enable_assert": { + "enable-assert": { "macro_name": "MBED_LFS2_ENABLE_ASSERT", "value": null, "help": "Enables asserts, true = enabled, false = disabled, null = disabled only in release builds" diff --git a/storage/kvstore/kv_config/filesystem/mbed_lib.json b/storage/kvstore/kv_config/filesystem/mbed_lib.json index 65eeca1c683..33060488f97 100644 --- a/storage/kvstore/kv_config/filesystem/mbed_lib.json +++ b/storage/kvstore/kv_config/filesystem/mbed_lib.json @@ -1,11 +1,11 @@ { - "name": "storage_filesystem", + "name": "storage-filesystem", "config": { - "rbp_internal_size": { + "rbp-internal-size": { "help": "Default is the larger of the last 2 sectors or last 14 pages of flash.", "value": "0" }, - "internal_base_address": { + "internal-base-address": { "help": "If default, base address is set to internal_size bytes before the end of flash.", "value": "0" }, @@ -17,26 +17,26 @@ "help": "Options are default, SPIF, DATAFASH, QSPIF, SD or other. If default, the block device will be chosen according to the component defined in targets.json. If other, override get_other_blockdevice() to support block device out of Mbed OS tree.", "value": "default" }, - "external_size": { + "external-size": { "help": "Size in bytes of the external block device, if default value, the maximum size available is used.", "value": "0" }, - "external_base_address": { + "external-base-address": { "help": "The default will set start address to address 0", "value": "0" }, - "mount_point": { + "mount-point": { "help": "Where to mount the filesystem.", "value": "kv" }, - "folder_path": { + "folder-path": { "help": "Path for the working directory where the FileSystemStore stores the data", "value": "kvstore" } }, "target_overrides": { "MCU_PSOC6": { - "rbp_internal_size": "7168" + "rbp-internal-size": "7168" }, "CY_EXTERNAL_WIFI_FW": { "blockdevice": "other" diff --git a/storage/kvstore/kv_config/global/mbed_lib.json b/storage/kvstore/kv_config/global/mbed_lib.json index d231ecd852f..5d64fb5d1fe 100644 --- a/storage/kvstore/kv_config/global/mbed_lib.json +++ b/storage/kvstore/kv_config/global/mbed_lib.json @@ -1,48 +1,48 @@ { "name": "storage", "config": { - "storage_type": { + "storage-type": { "help": "Options are TDB_INTERNAL, TDB_EXTERNAL, FILESYSTEM or default. If default, the storage type will be chosen according to the component defined in targets.json", "value": "default" }, - "default_kv": { + "default-kv": { "help": "A string name for the default kvstore configuration", "value": "kv" } }, "target_overrides": { "HANI_IOT": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "K66F": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "NUCLEO_F411RE": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "NUCLEO_F429ZI": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "NUCLEO_H743ZI": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "NUCLEO_H743ZI2": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "DISCO_H747I": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "DISCO_H747I_CM4": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "LPC55S69_S": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "ARM_MUSCA_B1_S": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" }, "ARM_MUSCA_S1_S": { - "storage_type": "TDB_INTERNAL" + "storage-type": "TDB_INTERNAL" } } } diff --git a/storage/kvstore/kv_config/tdb_external/mbed_lib.json b/storage/kvstore/kv_config/tdb_external/mbed_lib.json index 66a4c8b2dfc..07f605114c4 100644 --- a/storage/kvstore/kv_config/tdb_external/mbed_lib.json +++ b/storage/kvstore/kv_config/tdb_external/mbed_lib.json @@ -1,11 +1,11 @@ { - "name": "storage_tdb_external", + "name": "storage-tdb-external", "config": { - "rbp_internal_size": { + "rbp-internal-size": { "help": "Default is the larger of the last 2 sectors or last 14 pages of flash.", "value": "0" }, - "internal_base_address": { + "internal-base-address": { "help": "If default, the base address is set to internal_size bytes before the end of flash.", "value": "0" }, @@ -13,18 +13,18 @@ "help": "Options are default, SPIF, DATAFASH, QSPIF, SD or other. If default the block device will be chosen by the defined component. If other, override get_other_blockdevice() to support block device out of Mbed OS tree.", "value": "default" }, - "external_size": { + "external-size": { "help": "Size in bytes of the external block device, if default the maximum size available is used.", "value": "0" }, - "external_base_address": { + "external-base-address": { "help": "The default will set start address to address 0", "value": "0" } }, "target_overrides": { "MCU_PSOC6": { - "rbp_internal_size": "7168" + "rbp-internal-size": "7168" }, "CY_EXTERNAL_WIFI_FW": { "blockdevice": "other" diff --git a/storage/kvstore/kv_config/tdb_external_no_rbp/mbed_lib.json b/storage/kvstore/kv_config/tdb_external_no_rbp/mbed_lib.json deleted file mode 100644 index 53468f124c1..00000000000 --- a/storage/kvstore/kv_config/tdb_external_no_rbp/mbed_lib.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "storage_tdb_external_no_rbp", - "config": { - "WARNING": { - "help": "DEPRECATION WARNING: storage_tdb_external_no_rbp does not work and will be removed in the future", - "value": null - }, - "blockdevice": { - "help": "Options are default, SPIF, DATAFASH, QSPIF, SD or other. If default the block device will be chosen by the defined component. If other, override get_other_blockdevice() to support block device out of Mbed OS tree.", - "value": "default" - }, - "external_size": { - "help": "Size in bytes of the external block device, if default the maximum size available is used.", - "value": "0" - }, - "external_base_address": { - "help": "The default will set start address to address 0", - "value": "0" - } - }, - "target_overrides": { - "CY_EXTERNAL_WIFI_FW": { - "blockdevice": "other" - } - } -} diff --git a/storage/kvstore/kv_config/tdb_internal/mbed_lib.json b/storage/kvstore/kv_config/tdb_internal/mbed_lib.json index 1fee13eba92..bc345ffc4f0 100644 --- a/storage/kvstore/kv_config/tdb_internal/mbed_lib.json +++ b/storage/kvstore/kv_config/tdb_internal/mbed_lib.json @@ -1,53 +1,53 @@ { - "name": "storage_tdb_internal", + "name": "storage-tdb-internal", "config": { - "internal_size": { + "internal-size": { "help": "Size of the FlashIAP block device. Default size will be the larger of the last 2 sectors or last 14 pages of flash.", "value": "0" }, - "internal_base_address": { - "help": "If default, the base address is set to internal_size bytes before the end of flash.", + "internal-base-address": { + "help": "If default, the base address is set to internal-size bytes before the end of flash.", "value": "0" } }, "target_overrides": { "LPC55S69_S": { - "internal_size": "0x8000", - "internal_base_address": "0x00028000" + "internal-size": "0x8000", + "internal-base-address": "0x00028000" }, "LPC55S69_NS": { - "internal_size": "0x8000", - "internal_base_address": "0x00090000" + "internal-size": "0x8000", + "internal-base-address": "0x00090000" }, "DISCO_H747I": { - "internal_size": "2*FLASH_SECTOR_SIZE", - "internal_base_address": "0x080C0000" + "internal-size": "2*FLASH_SECTOR_SIZE", + "internal-base-address": "0x080C0000" }, "ARM_MUSCA_B1_S": { - "internal_size": "0x8000", - "internal_base_address": "0x10000000" + "internal-size": "0x8000", + "internal-base-address": "0x10000000" }, "ARM_MUSCA_S1_S": { - "internal_size": "0x8000", - "internal_base_address": "0x1A1CA000" + "internal-size": "0x8000", + "internal-base-address": "0x1A1CA000" }, "FVP_MPS2": { - "internal_size": "0x200000", - "internal_base_address": "0x00200000" + "internal-size": "0x200000", + "internal-base-address": "0x00200000" }, "NU_PFM_M2351_S": { - "internal_size": "0x8000", - "internal_base_address": "(PSA_SECURE_ROM_START + PSA_SECURE_ROM_SIZE - 0x1000 - MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)" + "internal-size": "0x8000", + "internal-base-address": "(PSA_SECURE_ROM_START + PSA_SECURE_ROM_SIZE - 0x1000 - MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)" }, "MCU_PSOC6": { - "internal_size": "0x10000" + "internal-size": "0x10000" }, "CYTFM_064B0S2_4343W": { - "internal_size": "0x8000", - "internal_base_address": "0x10168000" + "internal-size": "0x8000", + "internal-base-address": "0x10168000" }, "NUMAKER_IOT_M252": { - "internal_size": "0x2000" + "internal-size": "0x2000" } } } diff --git a/targets/targets.json5 b/targets/targets.json5 index f50c4d423a1..b9e083b2012 100644 --- a/targets/targets.json5 +++ b/targets/targets.json5 @@ -38,14 +38,6 @@ "help": "Time in ms required to go to and wake up from deep sleep (max 10)", "value": 0 }, - "app_offset": { - "help": "Application start offset in ROM", - "value": null - }, - "header_offset": { - "help": "Application header offset in ROM", - "value": null - }, "boot-stack-size": { "help": "Define the boot stack size in bytes. This value must be a multiple of 8", "value": "0x1000" @@ -59,7 +51,7 @@ "value": null }, "tickless-from-us-ticker": { - "help": "Run tickless from the microsecond ticker rather than the low power ticker. Running tickless off of the microsecond ticker improves interrupt latency on targets which use lpticker_delay_ticks", + "help": "Run tickless from the microsecond ticker rather than the low power ticker. Running tickless off of the microsecond ticker improves interrupt latency on targets which use lpticker-delay-ticks", "value": false }, "init-us-ticker-at-boot": { @@ -777,38 +769,38 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "USE_FULL_LL_DRIVER" ], "config": { - "lse_available": { + "lse-available": { "help": "Define if a Low Speed External xtal (LSE) is available on the board (0 = No, 1 = Yes). If Yes, the LSE will be used to clock the RTC, LPUART, ... otherwise the Low Speed Internal clock (LSI) will be used", "value": "1" }, - "lse_bypass": { + "lse-bypass": { "help": "Change to 1 to use a logic level oscillator (not a crystal) on 32k LSE", "value": "0" }, - "rtc_clock_source": { + "rtc-clock-source": { "help": "Define the RTC clock source. USE_RTC_CLK_LSE_OR_LSI, USE_RTC_CLK_LSI, USE_RTC_CLK_HSE. LPTICKER is not available for HSE and should be removed from the target configuration.", "value": "USE_RTC_CLK_LSE_OR_LSI" }, - "lpuart_clock_source": { + "lpuart-clock-source": { "help": "Define the LPUART clock source. LSE clock source will only be used when baudrate is slow (<= LSE freq / 3). Mask values: USE_LPUART_CLK_LSE, USE_LPUART_CLK_PCLK1, USE_LPUART_CLK_PCLK3, USE_LPUART_CLK_HSI, USE_LPUART_CLK_SYSCLK.", "value": "USE_LPUART_CLK_LSE|USE_LPUART_CLK_PCLK1|USE_LPUART_CLK_PCLK3|USE_LPUART_CLK_SYSCLK" }, - "stdio_uart_tx": { + "stdio-uart-tx": { "help": "default TX STDIO pins is defined in PinNames.h file, but it can be overridden" }, - "stdio_uart_rx": { + "stdio-uart-rx": { "help": "default RX STDIO pins is defined in PinNames.h file, but it can be overridden" }, - "lpticker_delay_ticks": { + "lpticker-delay-ticks": { "help": "https://os.mbed.com/docs/latest/porting/low-power-ticker.html", "value": 1, "macro_name": "LPTICKER_DELAY_TICKS" }, - "lpticker_lptim_clock": { - "help": "Default value for LPTIM clock (lpticker_lptim == 1). Value is the dividing factor. Choose 1, 2, 4, 8, 16, 32, 64 or 128. Disclaimer: values from 8 to 128 have impacts on mbed-os timer precision and therefore on scheduling. It's not supported by mbed-os. Use it if you know what you're doing such as long low power sleep.", + "lpticker-lptim-clock": { + "help": "Default value for LPTIM clock (lpticker-lptim == 1). Value is the dividing factor. Choose 1, 2, 4, 8, 16, 32, 64 or 128. Disclaimer: values from 8 to 128 have impacts on mbed-os timer precision and therefore on scheduling. It's not supported by mbed-os. Use it if you know what you're doing such as long low power sleep.", "value": 1 }, - "gpio_reset_at_init": { + "gpio-reset-at-init": { "help": "if value set, all GPIO are reset during init", "value": false } @@ -853,16 +845,16 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F0" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If set to true, I2C timing algorithm is enabled. Enabling may lead to performance issues. Keeping this false and changing system clock will trigger assert.)", "value": false } @@ -983,7 +975,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F1" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC|USE_PLL_HSE_XTAL|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" @@ -1104,7 +1096,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F2" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" @@ -1147,7 +1139,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "config": { - "d11_configuration": { + "d11-configuration": { "help": "Value: PA_7 for the default board configuration, PB_5 in case of solder bridge update (SB121 off/ SB122 on)", "value": "PA_7", "macro_name": "STM32_D11_SPI_ETHERNET_PIN" @@ -1174,16 +1166,16 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F3" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } @@ -1229,8 +1221,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32F303x8" ], "overrides": { - "clock_source": "USE_PLL_HSI", - "lse_available": 0 + "clock-source": "USE_PLL_HSI", + "lse-available": 0 }, "device_name": "STM32F303K8Tx", "image_url": "https://www.st.com/bin/ecommerce/api/image.PF262544.en.feature-description-include-personalized-no-cpn-medium.jpg" @@ -1316,7 +1308,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F4" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" @@ -1391,8 +1383,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", ], "device_name": "STM32F407VETx", "overrides": { - "clock_source": "USE_PLL_HSE_XTAL", - "lse_available": 0, + "clock-source": "USE_PLL_HSE_XTAL", + "lse-available": 0, "network-default-interface-type": "ETHERNET" }, "image_url": "https://mm.digikey.com/Volume0/opasdata/d220001/medias/images/1881/MFG_102110014.jpg" @@ -1427,7 +1419,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "overrides": { - "lse_available": 0 + "lse-available": 0 }, "macros_add": [ "HSE_VALUE=26000000" @@ -1450,7 +1442,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "HSE_VALUE=26000000" ], "overrides": { - "clock_source": "USE_PLL_HSE_XTAL" + "clock-source": "USE_PLL_HSE_XTAL" }, "device_has_remove": [ "FLASH", @@ -1467,7 +1459,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "HSE_VALUE=25000000U" ], "overrides": { - "clock_source": "USE_PLL_HSI | USE_PLL_HSE_XTAL" + "clock-source": "USE_PLL_HSI | USE_PLL_HSE_XTAL" }, "device_has_add": [ "USBDEVICE" @@ -1531,7 +1523,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", ], "device_name": "STM32F412ZGTx", "overrides": { - "clock_source": "USE_PLL_HSI", + "clock-source": "USE_PLL_HSI", "network-default-interface-type": "WIFI" }, "image_url": "https://cdn.mxchip.com/mxchip_official_website/img/EMW3166-P-%E7%99%BD-%E6%AD%A3.jpg" @@ -1545,13 +1537,13 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F413xH" ], "config": { - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, "overrides": { - "lpticker_delay_ticks": 4 + "lpticker-delay-ticks": 4 }, "macros_add": [ "STM32F413xx", @@ -1621,12 +1613,12 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "config": { - "d11_configuration": { + "d11-configuration": { "help": "Value: PA_7 for the default board configuration, PB_5 in case of solder bridge update (SB121 off/ SB122 on)", "value": "PA_7", "macro_name": "STM32_D11_SPI_ETHERNET_PIN" }, - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_OTG_FS" } @@ -1652,13 +1644,13 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32F429xI" ], "config": { - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_HS_IN_FS" } }, "overrides": { - "lse_available": 0 + "lse-available": 0 }, "device_has_remove": [ "LPTICKER" @@ -1692,12 +1684,12 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "config": { - "d11_configuration": { + "d11-configuration": { "help": "Value: PA_7 for the default board configuration, PB_5 in case of solder bridge update (SB121 off/ SB122 on)", "value": "PA_7", "macro_name": "STM32_D11_SPI_ETHERNET_PIN" }, - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_OTG_FS" } @@ -1746,7 +1738,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "config": { - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_OTG_FS" } @@ -1788,7 +1780,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "N25Q128A" ], "overrides": { - "clock_source": "USE_PLL_HSE_XTAL|USE_PLL_HSI" + "clock-source": "USE_PLL_HSE_XTAL|USE_PLL_HSI" }, "device_has_add": [ "QSPI", @@ -1805,19 +1797,19 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "config": { - "clock_freq": { + "clock-freq": { "help": "Clock frequency in Mhz", "value": "8", "macro_name": "CLOCK_FREQUENCY_MHZ" }, - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_OTG_HS" } }, "overrides": { - "clock_source": "USE_PLL_HSE_XTAL|USE_PLL_HSI", - "lse_available": 0 + "clock-source": "USE_PLL_HSE_XTAL|USE_PLL_HSI", + "lse-available": 0 }, "device_has_add": [ "QSPI", @@ -1841,26 +1833,26 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F7" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } }, "overrides": { - "lpticker_delay_ticks": 0, + "lpticker-delay-ticks": 0, "internal-flash-uniform-sectors": false }, "macros_add": [ @@ -1912,13 +1904,13 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "config": { - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_OTG_FS" } }, "overrides": { - "clock_source": "USE_PLL_HSE_XTAL|USE_PLL_HSI", + "clock-source": "USE_PLL_HSE_XTAL|USE_PLL_HSI", "network-default-interface-type": "ETHERNET" }, "macros_add": [ @@ -1942,7 +1934,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F746ZG" ], "config": { - "d11_configuration": { + "d11-configuration": { "help": "Value: PA_7 for the default board configuration, PB_5 in case of solder bridge update (SB121 off/ SB122 on)", "value": "PA_7", "macro_name": "STM32_D11_SPI_ETHERNET_PIN" @@ -1973,7 +1965,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F756ZG" ], "config": { - "d11_configuration": { + "d11-configuration": { "help": "Value: PA_7 for the default board configuration, PB_5 in case of solder bridge update (SB121 off/ SB122 on)", "value": "PA_7", "macro_name": "STM32_D11_SPI_ETHERNET_PIN" @@ -2004,7 +1996,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F767xI" ], "overrides": { - "clock_source": "USE_PLL_HSE_XTAL", + "clock-source": "USE_PLL_HSE_XTAL", "network-default-interface-type": "WIFI" }, "components_add": [ @@ -2028,11 +2020,11 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32F767ZI" ], "config": { - "flash_dual_bank": { + "flash-dual-bank": { "help": "Default board configuration is Single Bank Flash. If you enable Dual Bank with ST Link Utility, set value to 1", "value": "0" }, - "d11_configuration": { + "d11-configuration": { "help": "Value: PA_7 for the default board configuration, PB_5 in case of solder bridge update (SB121 off/ SB122 on)", "value": "PA_7", "macro_name": "STM32_D11_SPI_ETHERNET_PIN" @@ -2069,11 +2061,11 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "config": { - "flash_dual_bank": { + "flash-dual-bank": { "help": "Default board configuration is Single Bank Flash. If you enable Dual Bank with ST Link Utility, set value to 1", "value": "0" }, - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_OTG_HS" } @@ -2103,20 +2095,20 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "core": "Cortex-M0+", "c_lib": "small", "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } @@ -2129,8 +2121,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MBED_TICKLESS" ], "overrides": { - "lpuart_clock_source": "USE_LPUART_CLK_HSI", - "lpticker_delay_ticks": 0 + "lpuart-clock-source": "USE_LPUART_CLK_HSI", + "lpticker-delay-ticks": 0 }, "device_has_add": [ "SERIAL_ASYNCH", @@ -2151,8 +2143,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32G030xx" ], "overrides": { - "lpticker_delay_ticks": 1, - "lpticker_lptim": "0", + "lpticker-delay-ticks": 1, + "lpticker-lptim": "0", "boot-stack-size": "0x400" } }, @@ -2205,8 +2197,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32G050xx" ], "overrides": { - "lpticker_delay_ticks": 1, - "lpticker_lptim": "0", + "lpticker-delay-ticks": 1, + "lpticker-lptim": "0", "boot-stack-size": "0x400" } }, @@ -2262,8 +2254,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MBED_TICKLESS" ], "overrides": { - "lpticker_delay_ticks": 1, - "lpticker_lptim": "0" + "lpticker-delay-ticks": 1, + "lpticker-lptim": "0" } }, "MCU_STM32G071xB": { @@ -2318,8 +2310,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32G0B0xx" ], "overrides": { - "lpticker_delay_ticks": 1, - "lpticker_lptim": "0" + "lpticker-delay-ticks": 1, + "lpticker-lptim": "0" } }, "MCU_STM32G0B1xE": { @@ -2373,25 +2365,25 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "public": false, "core": "Cortex-M4F", "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC", "macro_name": "CLOCK_SOURCE" }, - "hse_value": { + "hse-value": { "help": "HSE default value is 8MHz in stm32g4xx_hal_conf.h", "value": "8000000", "macro_name": "HSE_VALUE" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } @@ -2404,7 +2396,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MBED_TICKLESS" ], "overrides": { - "lpticker_delay_ticks": 0 + "lpticker-delay-ticks": 0 }, "device_has_add": [ "ANALOGOUT", @@ -2438,7 +2430,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "overrides": { - "hse_value": 24000000 + "hse-value": 24000000 }, "device_name": "STM32G431RBTx", "image_url": "https://www.st.com/bin/ecommerce/api/image.PF267029.en.feature-description-include-personalized-no-cpn-medium.jpg" @@ -2448,8 +2440,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32G431xB" ], "overrides": { - "clock_source": "USE_PLL_HSI", - "lse_available": 0 + "clock-source": "USE_PLL_HSI", + "lse-available": 0 }, "device_name": "STM32G431KBTx", "image_url": "https://www.st.com/bin/ecommerce/api/image.PF267030.en.feature-description-include-personalized-no-cpn-medium.jpg" @@ -2510,7 +2502,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "overrides": { - "hse_value": 24000000 + "hse-value": 24000000 }, "device_name": "STM32G474RETx", "image_url": "https://www.st.com/bin/ecommerce/api/image.PF267029.en.feature-description-include-personalized-no-cpn-medium.jpg" @@ -2574,31 +2566,31 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32H5" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI|USE_PLL_HSE_XTAL", "macro_name": "CLOCK_SOURCE" }, - "hse_value": { + "hse-value": { "help": "Frequency in MHz of external oscillator / crystal. Will be used to compute PLL parameters.", "value": "8000000", "macro_name": "HSE_VALUE" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } }, "overrides": { - "lpticker_delay_ticks": 0 + "lpticker-delay-ticks": 0 }, "macros_add": [ "EXTRA_IDLE_STACK_REQUIRED", @@ -2638,9 +2630,9 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32H503xB" ], "overrides": { - "hse_value": 24000000, - "lse_available": 1, - "clock_source": "USE_PLL_HSE_XTAL|USE_PLL_HSI", + "hse-value": 24000000, + "lse-available": 1, + "clock-source": "USE_PLL_HSE_XTAL|USE_PLL_HSI", // ADC reference voltage is same as MCU VDD. // MCU VDD defaults to 3.3V though can be changed to 1.8V based on JP2 setting on nucleo board. @@ -2680,8 +2672,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32H563xI" ], "overrides": { - "lse_available": 1, - "clock_source": "USE_PLL_HSE_EXTC|USE_PLL_HSI", + "lse-available": 1, + "clock-source": "USE_PLL_HSE_EXTC|USE_PLL_HSI", // ADC reference voltage is same as MCU VDD. // MCU VDD defaults to 3.3V though can be changed to 1.8V based on JP4 setting on nucleo board. @@ -2718,9 +2710,9 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32H573xI" ], "overrides": { - "hse_value": 25000000, - "lse_available": 1, - "clock_source": "USE_PLL_HSE_XTAL|USE_PLL_HSI", + "hse-value": 25000000, + "lse-available": 1, + "clock-source": "USE_PLL_HSE_XTAL|USE_PLL_HSI", // ADC reference voltage is same as MCU VDD. // MCU VDD defaults to 3.3V though can be changed to 1.8V based on JP2 setting. @@ -2755,20 +2747,20 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32H7" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC | USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "system_power_supply": { + "system-power-supply": { accepted_values: [ "PWR_LDO_SUPPLY", "PWR_DIRECT_SMPS_SUPPLY", @@ -2782,7 +2774,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", ], "value": null }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false }, @@ -2790,7 +2782,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "help": "Enable 'overdrive mode' (also known as VOS0) and raise core clock to the maximum value. Only supported when the internal LDO is used for core voltage source. Reduces the temperature range of the chip, see datasheet for details.", "value": 1 }, - "hse_value": { + "hse-value": { "help": "Frequency in MHz of external oscillator / crystal. Will be used to compute PLL parameters.", "value": "8000000", "macro_name": "HSE_VALUE" @@ -2802,9 +2794,9 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "DATA_IN_D2_SRAM" // Flag to HAL Layer to initialize clock for D2 SRAM on boot ], "overrides": { - "lpticker_delay_ticks": 0, + "lpticker-delay-ticks": 0, // Mbed's clock code does not initialize PLL2, so we have to disable USE_LPUART_CLK_PCLK1 here. - "lpuart_clock_source": "USE_LPUART_CLK_LSE|USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" + "lpuart-clock-source": "USE_LPUART_CLK_LSE|USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" }, "device_has_add": [ "ANALOGOUT", @@ -2833,7 +2825,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32H723xx", ], "overrides": { - "system_power_supply": "PWR_LDO_SUPPLY" + "system-power-supply": "PWR_LDO_SUPPLY" } }, "MCU_STM32H725xE": { @@ -2851,7 +2843,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32H725xx" ], "overrides": { - "system_power_supply": "PWR_LDO_SUPPLY" + "system-power-supply": "PWR_LDO_SUPPLY" } }, "WIO_H725AE": { // AKA "Seeed Wio Lite AI" @@ -2859,7 +2851,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32H725xE" ], "config": { - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_HS_IN_FS" } @@ -2868,10 +2860,10 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "USBDEVICE" ], "overrides": { - "lse_available": 1, - "system_power_supply": "PWR_DIRECT_SMPS_SUPPLY", - "clock_source": "USE_PLL_HSI | USE_PLL_HSE_XTAL", - "lse_drive_load_level": "RCC_LSEDRIVE_MEDIUMLOW", + "lse-available": 1, + "system-power-supply": "PWR_DIRECT_SMPS_SUPPLY", + "clock-source": "USE_PLL_HSI | USE_PLL_HSE_XTAL", + "lse-drive-load-level": "RCC_LSEDRIVE_MEDIUMLOW", "enable-overdrive-mode": 0 }, "device_name": "STM32H725AEIx", @@ -2892,7 +2884,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MBED_SPLIT_HEAP" ], "overrides": { - "system_power_supply": "PWR_LDO_SUPPLY" + "system-power-supply": "PWR_LDO_SUPPLY" }, "device_name": "STM32H735AGIx" }, @@ -2911,7 +2903,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MBED_SPLIT_HEAP" ], "overrides": { - "system_power_supply": "PWR_LDO_SUPPLY" + "system-power-supply": "PWR_LDO_SUPPLY" } }, "NUCLEO_H743ZI2": { @@ -2919,7 +2911,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32H743xI" ], "config": { - "d11_configuration": { + "d11-configuration": { "help": "Value: PB_5 for the default board configuration, PA_7 in case of solder bridge update (SB33 on/ SB35 off)", "value": "PB_5", "macro_name": "STM32_D11_SPI_ETHERNET_PIN" @@ -2946,12 +2938,12 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32H723ZG" ], "config": { - "d11_configuration": { + "d11-configuration": { "help": "Value: PB_5 for the default board configuration, PA_7 in case of solder bridge update (SB33 on/ SB35 off)", "value": "PB_5", "macro_name": "STM32_D11_SPI_ETHERNET_PIN" }, - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_HS_IN_FS" } @@ -2961,8 +2953,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "USBDEVICE" ], "overrides": { - "clock_source": "USE_PLL_HSE_EXTC", - "lse_available": 1, + "clock-source": "USE_PLL_HSE_EXTC", + "lse-available": 1, "network-default-interface-type": "ETHERNET" }, "supported_form_factors": [ @@ -3029,12 +3021,12 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", ], "public": false, "config": { - "d11_configuration": { + "d11-configuration": { "help": "Value: PB_5 for the default board configuration, PA_7 in case of solder bridge update (SB33 on/ SB35 off)", "value": "PB_5", "macro_name": "STM32_D11_SPI_ETHERNET_PIN" }, - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_OTG_FS" }, @@ -3044,7 +3036,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", ], "overrides": { "network-default-interface-type": "ETHERNET", - "system_power_supply": "PWR_DIRECT_SMPS_SUPPLY", + "system-power-supply": "PWR_DIRECT_SMPS_SUPPLY", // Cannot enable overdrive mode because the default power supply is SMPS "enable-overdrive-mode": 0 }, @@ -3115,7 +3107,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "public": false, "inherits": ["MCU_STM32H747xI"], "overrides": { - "system_power_supply": "PWR_DIRECT_SMPS_SUPPLY", + "system-power-supply": "PWR_DIRECT_SMPS_SUPPLY", // Cannot enable overdrive mode because the default power supply is SMPS "enable-overdrive-mode": 0 }, @@ -3154,11 +3146,11 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "public": false, "inherits": ["MCU_STM32H747xI"], "config": { - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_OTG_HS" }, - "wifi_driver_in_qspi_flash": { + "wifi-driver-in-qspi-flash": { help: "If this is false, and wifi is used in the application, the wifi chip firmware will be included in the application firmware (+411kiB code size). If true, then the wifi firmware is loaded from the external QSPI flash instead, and you must install it using the Arduino IDE sketch for this purpose.", value: false } @@ -3185,9 +3177,9 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "QSPI" ], "overrides": { - "lse_available": 1, - "lpticker_delay_ticks": 0, - "i2c_timing_value_algo": true + "lse-available": 1, + "lpticker-delay-ticks": 0, + "i2c-timing-value-algo": true }, "device_name": "STM32H747XIHx" }, @@ -3195,18 +3187,18 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", public: false, inherits: ["STM32H747_ARDUINO"], overrides: { - system_power_supply: "PWR_LDO_SUPPLY", + "system-power-supply": "PWR_LDO_SUPPLY", "enable-overdrive-mode": 1, - clock_source: "USE_PLL_HSE_XTAL | USE_PLL_HSI", + "clock-source": "USE_PLL_HSE_XTAL | USE_PLL_HSI", "network-default-interface-type": "WIFI", - lpuart_clock_source: "USE_LPUART_CLK_HSI", - "hse_value": 16000000, + "lpuart-clock-source": "USE_LPUART_CLK_HSI", + "hse-value": 16000000, // Arduino Giga connects the primary USB port (USB-C port) to the USB Full Speed pins. // TODO eventually this needs to be runtime configurable so that the two USB ports // can use different speeds. With the current setting, Mbed will not be able to use // the host mode port as that port uses high speed. - "usb_speed": "USE_USB_OTG_FS", + "usb-speed": "USE_USB_OTG_FS", }, macros_add: [ "BT_UART_NO_3M_SUPPORT" @@ -3245,11 +3237,11 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "EMAC" ], "overrides": { - "system_power_supply": "PWR_SMPS_1V8_SUPPLIES_LDO", - "clock_source": "USE_PLL_HSE_EXTC", - "lse_bypass": 1, + "system-power-supply": "PWR_SMPS_1V8_SUPPLIES_LDO", + "clock-source": "USE_PLL_HSE_EXTC", + "lse-bypass": 1, "network-default-interface-type": "ETHERNET", - "hse_value": 25000000, + "hse-value": 25000000, // Can use overdrive because LDO is regulating core voltage (even though // the LDO power comes from the SMPS). "enable-overdrive-mode": 1, @@ -3303,7 +3295,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MBED_SPLIT_HEAP" ], "overrides": { - "system_power_supply": "PWR_LDO_SUPPLY" + "system-power-supply": "PWR_LDO_SUPPLY" }, "device_name": "STM32H750ZBTx" }, @@ -3322,7 +3314,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MBED_SPLIT_HEAP" ], "overrides": { - "system_power_supply": "PWR_LDO_SUPPLY" + "system-power-supply": "PWR_LDO_SUPPLY" } }, "MCU_STM32H7A3xIQ": { @@ -3349,7 +3341,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ARDUINO_UNO" ], "overrides": { - "system_power_supply": "PWR_DIRECT_SMPS_SUPPLY", + "system-power-supply": "PWR_DIRECT_SMPS_SUPPLY", // Cannot enable overdrive mode because the default power supply is SMPS "enable-overdrive-mode": 0 }, @@ -3371,7 +3363,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", ], "device_name": "STM32H7B3ZITxQ", "overrides": { - "system_power_supply": "PWR_DIRECT_SMPS_SUPPLY", + "system-power-supply": "PWR_DIRECT_SMPS_SUPPLY", // Cannot enable overdrive mode because the default power supply is SMPS "enable-overdrive-mode": 0 } @@ -3388,20 +3380,20 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32L0" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC (need HW patch) | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } @@ -3411,7 +3403,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "EXTRA_IDLE_STACK_REQUIRED" ], "overrides": { - "lpticker_delay_ticks": 0 + "lpticker-delay-ticks": 0 }, "device_has_add": [ "CRC", @@ -3477,8 +3469,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32L072xx" ], "overrides": { - "clock_source": "USE_PLL_HSI", - "lpticker_delay_ticks": 0 + "clock-source": "USE_PLL_HSI", + "lpticker-delay-ticks": 0 }, "device_has_add": [ "ANALOGOUT", @@ -3552,14 +3544,14 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32L1" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI", "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" } }, "overrides": { - "gpio_reset_at_init": true + "gpio-reset-at-init": true }, "device_has_add": [ "ANALOGOUT", @@ -3616,7 +3608,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32L151CC" ], "config": { - "hse_value": { + "hse-value": { "value": "24000000", "macro_name": "HSE_VALUE" } @@ -3697,20 +3689,20 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32L4" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC (need HW patch) | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI | USE_PLL_MSI", "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } @@ -3720,7 +3712,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "EXTRA_IDLE_STACK_REQUIRED" ], "overrides": { - "lpticker_delay_ticks": 0 + "lpticker-delay-ticks": 0 }, "device_has_add": [ "ANALOGOUT", @@ -3814,8 +3806,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32L443xC" ], "overrides": { - "clock_source": "USE_PLL_HSI", - "lse_available": 0 + "clock-source": "USE_PLL_HSI", + "lse-available": 0 }, "device_has_remove": [ "LPTICKER" @@ -3885,7 +3877,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32L475xG" ], "overrides": { - "lpuart_clock_source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" + "lpuart-clock-source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" }, "macros_add": [ "STM32L475xx", @@ -3927,7 +3919,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32L476xG" ], "overrides": { - "lpuart_clock_source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" + "lpuart-clock-source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" }, "macros_add": [ "STM32L476xx", @@ -3970,7 +3962,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32L486xG" ], "overrides": { - "lpuart_clock_source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" + "lpuart-clock-source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" }, "macros_add": [ "STM32L486xx", @@ -3997,7 +3989,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32L496xG" ], "overrides": { - "lpuart_clock_source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" + "lpuart-clock-source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" }, "macros_add": [ "STM32L496xx", @@ -4188,26 +4180,26 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "EXTRA_IDLE_STACK_REQUIRED" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC (need HW patch) | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI | USE_PLL_MSI", "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } }, "overrides": { - "lpticker_delay_ticks": 0 + "lpticker-delay-ticks": 0 }, "device_has_add": [ "ANALOGOUT", @@ -4298,30 +4290,30 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MBED_TICKLESS" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC (need HW patch) | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI | USE_PLL_MSI", "value": "USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false }, - "usb_speed": { + "usb-speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_NO_OTG" } }, "overrides": { - "lpticker_delay_ticks": 0 + "lpticker-delay-ticks": 0 }, "device_has_add": [ "CRC", @@ -4350,8 +4342,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MCU_STM32U083xC" ], "overrides": { - "clock_source": "USE_PLL_HSI", // Use HSI by default, other options require hardware changes - "lse_available": 1, + "clock-source": "USE_PLL_HSI", // Use HSI by default, other options require hardware changes + "lse-available": 1, "default-adc-vref": 3.3 }, "supported_form_factors": [ @@ -4376,37 +4368,37 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "EXTRA_IDLE_STACK_REQUIRED" ], "config": { - "clock_source": { + "clock-source": { "help": "Mask value : USE_PLL_HSE_EXTC (need HW patch) | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI | USE_PLL_MSI", "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "hse_value": { + "hse-value": { "help": "HSE default value is 16MHz in stm32u5xx_hal_conf.h, The effective value is within the range of 4MHz to 50MHz and can be divided by 4MHz or 5MHz.", "value": "16000000", "macro_name": "HSE_VALUE" }, - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false }, - "qspi_ospim_ioport_high": { + "qspi-ospim-ioport-high": { "help": "When using the OSPI peripheral in QSPI mode, set value 1 to use IO 7~4 for data, or 0 to use IO 3~0. Affects both OCTOSPI1 and OCTOSPI2 instances.", "value": 0, "macro_name": "QSPI_OSPIM_IOPORT_HIGH" } }, "overrides": { - "lpticker_delay_ticks": 0, - "lpuart_clock_source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" + "lpticker-delay-ticks": 0, + "lpuart-clock-source": "USE_LPUART_CLK_HSI|USE_LPUART_CLK_SYSCLK" }, "device_has_add": [ "ANALOGOUT", @@ -4568,15 +4560,15 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "CORDIO" ], "config": { - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } @@ -4586,7 +4578,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "EXTRA_IDLE_STACK_REQUIRED" ], "overrides": { - "lpticker_delay_ticks": 0 + "lpticker-delay-ticks": 0 }, "device_has_add": [ "CRC", @@ -4709,15 +4701,15 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "STM32WL" ], "config": { - "lpticker_lptim": { + "lpticker-lptim": { "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 }, - "lse_drive_load_level": { + "lse-drive-load-level": { "help": "HSE drive load level RCC_LSEDRIVE_LOW | RCC_LSEDRIVE_MEDIUMLOW | RCC_LSEDRIVE_MEDIUMHIGH | RCC_LSEDRIVE_HIGH", "value": "RCC_LSEDRIVE_LOW" }, - "i2c_timing_value_algo": { + "i2c-timing-value-algo": { "help": "If value was set to true I2C timing algorithm is enabled. Enabling may leads to performance issue. Keeping this false and changing system clock will trigger assert.)", "value": false } @@ -4727,7 +4719,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "EXTRA_IDLE_STACK_REQUIRED" ], "overrides": { - "lpticker_delay_ticks": 0 + "lpticker-delay-ticks": 0 }, "device_has_add": [ "MPU", @@ -5882,15 +5874,15 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "MAX32660EVSYS" ], "config": { - "stdio_uart": { + "stdio-uart": { "help": "default STDIO port is defined in PeripheralNames.h file, but it can be overridden, default UART_1", "value": null }, - "stdio_uart_tx": { + "stdio-uart-tx": { "help": "default TX STDIO pins is defined in PinNames.h file, but it can be overridden, default P0_10", "value": null }, - "stdio_uart_rx": { + "stdio-uart-rx": { "help": "default RX STDIO pins is defined in PinNames.h file, but it can be overridden, default P0_11", "value": null } @@ -5929,23 +5921,23 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "FLASH" ], "config": { - "stdio_uart": { + "stdio-uart": { "help": "default STDIO port is defined in PeripheralNames.h file, but it can be overridden, default UART_0", "value": null }, - "stdio_uart_tx": { + "stdio-uart-tx": { "help": "default TX STDIO pins is defined in PinNames.h file, but it can be overridden, default P0_9", "value": null }, - "stdio_uart_rx": { + "stdio-uart-rx": { "help": "default RX STDIO pins is defined in PinNames.h file, but it can be overridden, default P0_8", "value": null }, - "us_ticker_timer": { + "us-ticker-timer": { "help": "Select which timer (0-3) to use for us_ticker.c", "value": 1 }, - "lp_ticker_timer": { + "lp-ticker-timer": { "help": "Select which low power timer (0-1) to use for lp_ticker.c", "value": 1 } @@ -6018,28 +6010,28 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "WATCHDOG" ], "config": { - "hf_clock_src": { + "hf-clock-src": { "help": "Value: HFXO for external crystal, HFRCO for internal RC oscillator", "value": "HFXO", "macro_name": "CORE_CLOCK_SOURCE" }, - "hfxo_clock_freq": { + "hfxo-clock-freq": { "help": "Value: External crystal frequency in hertz", "value": "48000000", "macro_name": "HFXO_FREQUENCY" }, - "lf_clock_src": { + "lf-clock-src": { "help": "Value: LFXO for external crystal, LFRCO for internal RC oscillator, ULFRCO for internal 1KHz RC oscillator", "value": "LFXO", "macro_name": "LOW_ENERGY_CLOCK_SOURCE" }, - "lfxo_clock_freq": { + "lfxo-clock-freq": { "help": "Value: External crystal frequency in hertz", "value": "32768", "macro_name": "LFXO_FREQUENCY" }, - "hfrco_clock_freq": { - "help": "Value: Frequency in hertz, must correspond to setting of hfrco_band_select", + "hfrco-clock-freq": { + "help": "Value: Frequency in hertz, must correspond to setting of hfrco-band-select", "value": "32000000", "macro_name": "HFRCO_FREQUENCY" } @@ -6060,8 +6052,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ANALOGOUT" ], "config": { - "hfrco_band_select": { - "help": "Value: One of _CMU_HFRCOCTRL_BAND_28MHZ, _CMU_HFRCOCTRL_BAND_21MHZ, _CMU_HFRCOCTRL_BAND_14MHZ, _CMU_HFRCOCTRL_BAND_11MHZ, _CMU_HFRCOCTRL_BAND_7MHZ, _CMU_HFRCOCTRL_BAND_1MHZ. Be sure to set hfrco_clock_freq accordingly!", + "hfrco-band-select": { + "help": "Value: One of _CMU_HFRCOCTRL_BAND_28MHZ, _CMU_HFRCOCTRL_BAND_21MHZ, _CMU_HFRCOCTRL_BAND_14MHZ, _CMU_HFRCOCTRL_BAND_11MHZ, _CMU_HFRCOCTRL_BAND_7MHZ, _CMU_HFRCOCTRL_BAND_1MHZ. Be sure to set hfrco-clock-freq accordingly!", "value": "_CMU_HFRCOCTRL_BAND_21MHZ", "macro_name": "HFRCO_FREQUENCY_ENUM" } @@ -6078,14 +6070,14 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "EFM32GG990F1024" ], "config": { - "board_controller_enable": { + "board-controller-enable": { "help": "Pin to pull high for enabling the USB serial port", "value": "PF7", "macro_name": "EFM_BC_EN" } }, "overrides": { - "hfrco_clock_freq": "21000000" + "hfrco-clock-freq": "21000000" }, "image_url": "https://www.silabs.com/content/dam/siliconlabs/images/products/microcontrollers/32-bit_mcus/giant_gecko/giant-gecko-starter-kit.jpg" }, @@ -6105,8 +6097,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "CRC" ], "config": { - "hfrco_band_select": { - "help": "Value: One of cmuHFRCOFreq_1M0Hz, cmuHFRCOFreq_2M0Hz, cmuHFRCOFreq_4M0Hz, cmuHFRCOFreq_7M0Hz, cmuHFRCOFreq_13M0Hz, cmuHFRCOFreq_16M0Hz, cmuHFRCOFreq_19M0Hz, cmuHFRCOFreq_26M0Hz, cmuHFRCOFreq_32M0Hz, cmuHFRCOFreq_38M0Hz. Be sure to set hfrco_clock_freq accordingly!", + "hfrco-band-select": { + "help": "Value: One of cmuHFRCOFreq_1M0Hz, cmuHFRCOFreq_2M0Hz, cmuHFRCOFreq_4M0Hz, cmuHFRCOFreq_7M0Hz, cmuHFRCOFreq_13M0Hz, cmuHFRCOFreq_16M0Hz, cmuHFRCOFreq_19M0Hz, cmuHFRCOFreq_26M0Hz, cmuHFRCOFreq_32M0Hz, cmuHFRCOFreq_38M0Hz. Be sure to set hfrco-clock-freq accordingly!", "value": "cmuHFRCOFreq_32M0Hz", "macro_name": "HFRCO_FREQUENCY_ENUM" } @@ -6124,7 +6116,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", ], "overrides": { "network-default-interface-type": "MESH", - "hfxo_clock_freq": "38400000", + "hfxo-clock-freq": "38400000", }, "image_url": "https://mm.digikey.com/Volume0/opasdata/d220001/medias/images/2145/MFG_SLTB004A.jpg" }, @@ -6144,8 +6136,8 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "ITM" ], "config": { - "hfrco_band_select": { - "help": "Value: One of cmuHFRCOFreq_1M0Hz, cmuHFRCOFreq_2M0Hz, cmuHFRCOFreq_4M0Hz, cmuHFRCOFreq_7M0Hz, cmuHFRCOFreq_13M0Hz, cmuHFRCOFreq_16M0Hz, cmuHFRCOFreq_19M0Hz, cmuHFRCOFreq_26M0Hz, cmuHFRCOFreq_32M0Hz, cmuHFRCOFreq_38M0Hz. Be sure to set hfrco_clock_freq accordingly!", + "hfrco-band-select": { + "help": "Value: One of cmuHFRCOFreq_1M0Hz, cmuHFRCOFreq_2M0Hz, cmuHFRCOFreq_4M0Hz, cmuHFRCOFreq_7M0Hz, cmuHFRCOFreq_13M0Hz, cmuHFRCOFreq_16M0Hz, cmuHFRCOFreq_19M0Hz, cmuHFRCOFreq_26M0Hz, cmuHFRCOFreq_32M0Hz, cmuHFRCOFreq_38M0Hz. Be sure to set hfrco-clock-freq accordingly!", "value": "cmuHFRCOFreq_32M0Hz", "macro_name": "HFRCO_FREQUENCY_ENUM" } @@ -6162,12 +6154,12 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "EFM32GG11B820F2048GL192" ], "config": { - "board_controller_enable": { + "board-controller-enable": { "help": "Pin to pull high for enabling the USB serial port", "value": "PE1", "macro_name": "EFM_BC_EN" }, - "qspi_flash_enable": { + "qspi-flash-enable": { "help": "Pin to pull high for enabling the on-board QSPI flash", "value": "PG13", "macro_name": "QSPI_FLASH_EN" @@ -6175,7 +6167,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "overrides": { "network-default-interface-type": "ETHERNET", - "hfxo_clock_freq": "50000000" + "hfxo-clock-freq": "50000000" }, "image_url": "https://www.silabs.com/content/dam/siliconlabs/images/products/microcontrollers/32-bit_mcus/giant-gecko-gg11/efr32gg11-starter-kit.jpg" }, @@ -6233,24 +6225,24 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "NORDIC_CORDIO" ], "config": { - "lf_clock_src": { + "lf-clock-src": { "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC", "help": "Select Low Frequency clock source. Options: NRF_LF_SRC_XTAL, NRF_LF_SRC_SYNTH, and NRF_LF_SRC_RC", "value": "NRF_LF_SRC_XTAL" }, - "lf_clock_rc_calib_timer_interval": { + "lf-clock-rc-calib-timer-interval": { "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL", "value": 16 }, - "lf_clock_rc_calib_mode_config": { + "lf-clock-rc-calib-mode-config": { "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG", "value": 0 }, - "uart_0_fifo_size": { + "uart-0-fifo-size": { "help": "UART0 FIFO buffer. FIFO buffer is filled from DMA buffer.", "value": 32 }, - "uart_1_fifo_size": { + "uart-1-fifo-size": { "help": "UART1 FIFO buffer. FIFO buffer is filled from DMA buffer.", "value": 32 } @@ -6385,28 +6377,28 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "NORDIC_CORDIO" ], "config": { - "lf_clock_src": { + "lf-clock-src": { "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC", "help": "Select Low Frequency clock source. Options: NRF_LF_SRC_XTAL, NRF_LF_SRC_SYNTH, and NRF_LF_SRC_RC", "value": "NRF_LF_SRC_XTAL" }, - "lf_clock_rc_calib_timer_interval": { + "lf-clock-rc-calib-timer-interval": { "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL", "value": 16 }, - "lf_clock_rc_calib_mode_config": { + "lf-clock-rc-calib-mode-config": { "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG", "value": 0 }, - "uart_0_fifo_size": { + "uart-0-fifo-size": { "help": "UART0 FIFO buffer. FIFO buffer is filled from DMA buffer.", "value": 32 }, - "uart_1_fifo_size": { + "uart-1-fifo-size": { "help": "UART1 FIFO buffer. FIFO buffer is filled from DMA buffer.", "value": 32 }, - "qspif_sfdp_data_len": { + "qspif-sfdp-data-len": { "help": "length of Flash SFDP DATA", "value": 128, "macro_name": "QSPIF_SFDP_DATA_LEN" @@ -6508,12 +6500,12 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "device_name": "nRF52840_xxAA", "supported_form_factors": [], "config": { - "modem_is_on_board": { + "modem-is-on-board": { "help": "Value: Tells the build system that the modem is on-board as oppose to a plug-in shield/module.", "value": 1, "macro_name": "MODEM_ON_BOARD" }, - "modem_data_connection_type": { + "modem-data-connection-type": { "help": "Value: Defines how an on-board modem is wired up to the MCU, e.g., data connection can be a UART or USB and so forth.", "value": 1, "macro_name": "MODEM_ON_BOARD_UART" diff --git a/tools/python/mbed_tools/build/_internal/config/source.py b/tools/python/mbed_tools/build/_internal/config/source.py index ca39be8794e..aa19087aae6 100644 --- a/tools/python/mbed_tools/build/_internal/config/source.py +++ b/tools/python/mbed_tools/build/_internal/config/source.py @@ -78,20 +78,35 @@ def prepare( return data -def check_and_transform_config_name(context: str, config_name: str) -> str: +def _to_canonical_json_setting_name(name: str) -> str: + """ + Transform a JSON setting name to its "canonical" form by replacing underscores with dashes and lowercasing. + + This is used for backwards compatibility, so that "canonical" settings can be overridden by old, non-canonical + names. + """ + return name.replace("_", "-").lower() + + +def check_and_transform_config_name(context: str, config_namespace: str, config_name: str) -> tuple[str, str]: """ Issue a warning if a config name is not recommended to be used, and transform the name into the recommended format. :param context: String that will be printed about where this warning comes from. Should be something like "file foo.json" or "target MCU_FOO". + :param config_namespace: Namespace of this config item. :param config_name: Name of config - :return: New name to use for the config. + :return: New namespace and name to use for the config. """ if config_name.lower() != config_name: logger.warning( f"Config setting '{config_name}' in {context} contains uppercase letters. This style is not recommended and these will be replaced by lowercase letters." ) + if config_namespace.lower() != config_namespace: + logger.warning( + f"Config namespace '{config_namespace}' in {context} contains uppercase letters. This style is not recommended and these will be replaced by lowercase letters." + ) if "." in config_name: logger.warning( f"Config setting '{config_name}' in {context} contains a period. This style is not recommended as it may cause confusion with the config namespace name." @@ -100,8 +115,12 @@ def check_and_transform_config_name(context: str, config_name: str) -> str: logger.warning( f"Config setting '{config_name}' in {context} contains an underscore. This style is not recommended as it may cause confusion (config names should be in skewer-case). Underscores are replaced by hyphens when Mbed processes JSON settings." ) + if "_" in config_namespace: + logger.warning( + f"Config namespace '{config_namespace}' in {context} contains an underscore. This style is not recommended as it may cause confusion (config names should be in skewer-case). Underscores are replaced by hyphens when Mbed processes JSON settings." + ) - return config_name.replace("_", "-").lower() + return _to_canonical_json_setting_name(config_namespace), _to_canonical_json_setting_name(config_name) def from_mbed_lib_json_file( @@ -149,12 +168,14 @@ def from_mbed_lib_json_file( continue # Remove all underscores in the setting name and replace with hyphens, as this makes settings harder to get wrong - transformed_config_name = check_and_transform_config_name(context, config_name) + transformed_config_namespace, transformed_config_name = check_and_transform_config_name( + context, mbed_lib.name, config_name + ) logger.debug("Extracting config setting from '%s': '%s'='%s'", mbed_lib.name, config_name, item) if isinstance(item, schemas.ConfigEntryDetails): setting = ConfigSetting( - namespace=mbed_lib.name, + namespace=transformed_config_namespace, name=transformed_config_name, macro_name=item.macro_name, help_text=item.help, @@ -165,7 +186,7 @@ def from_mbed_lib_json_file( ) else: setting = ConfigSetting( - namespace=mbed_lib.name, + namespace=transformed_config_namespace, name=transformed_config_name, macro_name=None, help_text=None, @@ -286,10 +307,14 @@ def _extract_config_settings(context: str, namespace: str, config_data: dict) -> help_text = None value = item - transformed_name = check_and_transform_config_name(context, name) + transformed_namespace, transformed_name = check_and_transform_config_name(context, namespace, name) setting = ConfigSetting( - namespace=namespace, name=transformed_name, macro_name=macro_name, help_text=help_text, value=value + namespace=transformed_namespace, + name=transformed_name, + macro_name=macro_name, + help_text=help_text, + value=value, ) # If the config item is about a certain component or feature # being present, avoid adding it to the mbed_config.cmake @@ -331,10 +356,11 @@ def _extract_overrides( override_namespace = namespace override_name = name - # Remove all underscores in the setting name and replace with hyphens, as this makes settings harder to get wrong - override_name = override_name.replace("_", "-") + # Make the override names canonical, to match the transforms done to the actual settings + override_name = _to_canonical_json_setting_name(override_name) + override_namespace = _to_canonical_json_setting_name(override_namespace) - if override_namespace not in {namespace, "target"} and namespace != "app": + if override_namespace not in {_to_canonical_json_setting_name(namespace), "target"} and namespace != "app": msg = ( "mbed_lib.json files may only override their own settings and settings from targets.json5." f"An override was defined by {context} that attempts to override " diff --git a/tools/python/mbed_tools/build/config.py b/tools/python/mbed_tools/build/config.py index f2ddc688dc1..e82421bb892 100644 --- a/tools/python/mbed_tools/build/config.py +++ b/tools/python/mbed_tools/build/config.py @@ -95,7 +95,7 @@ def _load_raw_targets_data(program: MbedProgram) -> dict[str, TargetJSON]: # We need to do this here, or otherwise warnings will only get printed # for the currently selected target instead of any defined target. for config_setting in target_json.config: - _ = check_and_transform_config_name("target " + target, config_setting) + _ = check_and_transform_config_name("target " + target, "target", config_setting) results[target] = target_json except pydantic.ValidationError: