Upgrade to Zephyr 2.4
- Make all struct device * constant - Add additional argument to PWM nodes in devicetree - Track customized LibreSolar/zephyr branch in platformio - Update OLED submodule
This commit is contained in:
@@ -46,7 +46,7 @@ static const struct pin_config pinconf[] = {
|
||||
#endif /* CONFIG_DAC, dac1 */
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
static int pinmux_stm32_init(const struct device *port)
|
||||
{
|
||||
ARG_UNUSED(port);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
pwm_switch {
|
||||
label = "PWM power switch (solar panel)";
|
||||
pwms = <&pwm3 2 (20*1000*1000)>; /* 20 ms period = 50 Hz */
|
||||
pwms = <&pwm3 2 (20*1000*1000) PWM_POLARITY_NORMAL>; /* 20 ms period = 50 Hz */
|
||||
current-max = <20>;
|
||||
kconfig-flag; /* make node visible in Kconfig */
|
||||
};
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
charge_pump {
|
||||
label = "Charge pump for HS MOSFET drivers";
|
||||
pwms = <&pwm8 1 200000>; /* 200 us period = 5 kHz */
|
||||
pwms = <&pwm8 1 200000 PWM_POLARITY_NORMAL>; /* 200 us period = 5 kHz */
|
||||
};
|
||||
|
||||
hv-ext-sense {
|
||||
|
||||
@@ -54,7 +54,7 @@ static const struct pin_config pinconf[] = {
|
||||
#endif /* CONFIG_USB_DC_STM32 */
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
static int pinmux_stm32_init(const struct device *port)
|
||||
{
|
||||
ARG_UNUSED(port);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ static const struct pin_config pinconf[] = {
|
||||
#endif /* CONFIG_CAN, can1 */
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
static int pinmux_stm32_init(const struct device *port)
|
||||
{
|
||||
ARG_UNUSED(port);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ static const struct pin_config pinconf[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
static int pinmux_stm32_init(const struct device *port)
|
||||
{
|
||||
ARG_UNUSED(port);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ static const struct pin_config pinconf[] = {
|
||||
#endif /* CONFIG_SPI, spi1 */
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
static int pinmux_stm32_init(const struct device *port)
|
||||
{
|
||||
ARG_UNUSED(port);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
pwm_switch {
|
||||
label = "PWM power switch (solar panel)";
|
||||
pwms = <&pwm3 4 (20*1000*1000)>; /* 20 ms period = 50 Hz */
|
||||
pwms = <&pwm3 4 (20*1000*1000) PWM_POLARITY_NORMAL>; /* 20 ms period = 50 Hz */
|
||||
// Current reduced to 15A. Increase to 20A PCB max values
|
||||
// only if attached to a big heat sink.
|
||||
current-max = <15>;
|
||||
@@ -162,7 +162,7 @@
|
||||
status = "okay";
|
||||
st,prescaler = <10000>;
|
||||
label = "PWM_3";
|
||||
#pwm-cells = <2>;
|
||||
#pwm-cells = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
+1
-1
Submodule lib/oled-display updated: 3b10da79dc...4eec1ea4d8
@@ -0,0 +1,8 @@
|
||||
|
||||
# Custom settings, as referred to as "extra_script" in platformio.ini
|
||||
#
|
||||
# See http://docs.platformio.org/en/latest/projectconf.html#extra-script
|
||||
|
||||
Import("env")
|
||||
|
||||
env.Append( CXXFLAGS=[ "-Wno-register -fno-rtti" ] )
|
||||
+8
-3
@@ -23,12 +23,14 @@ extra_configs =
|
||||
|
||||
[env]
|
||||
|
||||
# ststm32 platform release >7.1.1 includes Zephyr 2.3.0
|
||||
#platform = https://github.com/platformio/platform-ststm32.git
|
||||
platform = ststm32@~8.0.0
|
||||
platform = ststm32@~8.1.0
|
||||
|
||||
framework = zephyr
|
||||
|
||||
# Use customized Zephyr branch from Libre Solar repository
|
||||
platform_packages = framework-zephyr@https://github.com/LibreSolar/zephyr#v2.4-branch
|
||||
|
||||
#upload_protocol = mbed
|
||||
upload_protocol = stlink
|
||||
#upload_protocol = jlink
|
||||
@@ -44,7 +46,10 @@ build_flags =
|
||||
-fsingle-precision-constant
|
||||
-Wl,-Map,memory.map
|
||||
|
||||
build_unflags = -std=gnu++98 -std=gnu++14
|
||||
# Below flags are only valid for C++ and create warnings for C files, so we add them as
|
||||
# CXXFLAGS in extra_script.
|
||||
build_unflags = -Wno-register -fno-rtti
|
||||
extra_scripts = platformio-extra.py
|
||||
|
||||
check_tool = cppcheck, clangtidy
|
||||
check_flags =
|
||||
|
||||
+1
-1
@@ -257,7 +257,7 @@ static void adc_init(ADC_TypeDef *adc)
|
||||
static void adc_setup()
|
||||
{
|
||||
#if DT_NODE_EXISTS(DT_PROP(V_HIGH_ENABLE_GPIO, enable_gpios))
|
||||
struct device *dev = device_get_binding(DT_GPIO_LABEL(V_HIGH_ENABLE_GPIO, enable_gpios));
|
||||
const struct device *dev = device_get_binding(DT_GPIO_LABEL(V_HIGH_ENABLE_GPIO, enable_gpios));
|
||||
gpio_pin_configure(dev, DT_GPIO_PIN(V_HIGH_ENABLE_GPIO, enable_gpios),
|
||||
DT_GPIO_FLAGS(V_HIGH_ENABLE_GPIO, enable_gpios) | GPIO_OUTPUT_ACTIVE);
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -335,7 +335,7 @@ void Dcdc::fuse_destruction()
|
||||
void Dcdc::output_hvs_enable()
|
||||
{
|
||||
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), hv_ext_sense))
|
||||
struct device *dev_hv_ext = device_get_binding(DT_GPIO_LABEL(HV_EXT_SENSE_GPIO, gpios));
|
||||
const struct device *dev_hv_ext = device_get_binding(DT_GPIO_LABEL(HV_EXT_SENSE_GPIO, gpios));
|
||||
gpio_pin_configure(dev_hv_ext, DT_GPIO_PIN(HV_EXT_SENSE_GPIO, gpios),
|
||||
DT_GPIO_FLAGS(HV_EXT_SENSE_GPIO, gpios) | GPIO_OUTPUT_ACTIVE);
|
||||
#endif
|
||||
@@ -344,7 +344,7 @@ void Dcdc::output_hvs_enable()
|
||||
void Dcdc::output_hvs_disable()
|
||||
{
|
||||
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), hv_ext_sense))
|
||||
struct device *dev_hv_ext = device_get_binding(DT_GPIO_LABEL(HV_EXT_SENSE_GPIO, gpios));
|
||||
const struct device *dev_hv_ext = device_get_binding(DT_GPIO_LABEL(HV_EXT_SENSE_GPIO, gpios));
|
||||
gpio_pin_configure(dev_hv_ext, DT_GPIO_PIN(HV_EXT_SENSE_GPIO, gpios),
|
||||
DT_GPIO_FLAGS(HV_EXT_SENSE_GPIO, gpios) | GPIO_OUTPUT_INACTIVE);
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -71,7 +71,7 @@ void eeprom_restore_data()
|
||||
uint8_t buf_req[300]; // ThingSet request buffer
|
||||
int err;
|
||||
|
||||
struct device *eeprom_dev = device_get_binding("EEPROM_0");
|
||||
const struct device *eeprom_dev = device_get_binding("EEPROM_0");
|
||||
|
||||
// EEPROM header
|
||||
uint8_t buf_header[EEPROM_HEADER_SIZE] = {}; // initialize to avoid compiler warning
|
||||
@@ -114,7 +114,7 @@ void eeprom_store_data()
|
||||
{
|
||||
uint8_t buf[300];
|
||||
|
||||
struct device *eeprom_dev = device_get_binding("EEPROM_0");
|
||||
const struct device *eeprom_dev = device_get_binding("EEPROM_0");
|
||||
|
||||
int len = ts.bin_pub(buf + EEPROM_HEADER_SIZE, sizeof(buf) - EEPROM_HEADER_SIZE, PUB_NVM);
|
||||
uint32_t crc = _calc_crc(buf + EEPROM_HEADER_SIZE, len);
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ LOG_MODULE_REGISTER(ext_can, CONFIG_LOG_DEFAULT_LEVEL);
|
||||
extern ThingSet ts;
|
||||
extern uint16_t ts_can_node_id;
|
||||
|
||||
struct device *can_dev;
|
||||
const struct device *can_dev;
|
||||
|
||||
#ifdef CONFIG_ISOTP
|
||||
|
||||
@@ -127,7 +127,7 @@ void can_pub_thread()
|
||||
unsigned int can_id;
|
||||
uint8_t can_data[8];
|
||||
|
||||
struct device *can_en_dev = device_get_binding(DT_GPIO_LABEL(CAN_EN_GPIO, gpios));
|
||||
const struct device *can_en_dev = device_get_binding(DT_GPIO_LABEL(CAN_EN_GPIO, gpios));
|
||||
gpio_pin_configure(can_en_dev, DT_GPIO_PIN(CAN_EN_GPIO, gpios),
|
||||
DT_GPIO_FLAGS(CAN_EN_GPIO, gpios) | GPIO_OUTPUT_ACTIVE);
|
||||
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ void oled_update()
|
||||
void oled_thread()
|
||||
{
|
||||
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), uext_en))
|
||||
struct device *dev_uext_en = device_get_binding(DT_GPIO_LABEL(UEXT_EN_GPIO, gpios));
|
||||
const struct device *dev_uext_en = device_get_binding(DT_GPIO_LABEL(UEXT_EN_GPIO, gpios));
|
||||
gpio_pin_configure(dev_uext_en, DT_GPIO_PIN(UEXT_EN_GPIO, gpios),
|
||||
DT_GPIO_FLAGS(UEXT_EN_GPIO, gpios) | GPIO_OUTPUT_ACTIVE);
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@
|
||||
#error "No UART for ThingSet serial defined."
|
||||
#endif
|
||||
|
||||
struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
|
||||
const struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
|
||||
|
||||
static char buf_resp[CONFIG_THINGSET_SERIAL_TX_BUF_SIZE];
|
||||
static char buf_req[CONFIG_THINGSET_SERIAL_RX_BUF_SIZE];
|
||||
@@ -73,7 +73,7 @@ void process_asap()
|
||||
* Read characters from stream until line end \n detected, signal command available then
|
||||
* and wait for processing
|
||||
*/
|
||||
void process_input(void* user_data)
|
||||
void process_input(const struct device *dev, void* user_data)
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ struct sw_wdt_channel {
|
||||
uint32_t timeout; // timeout of corresponding thread for sw_watchdog
|
||||
};
|
||||
|
||||
static struct device *wdt;
|
||||
static const struct device *wdt;
|
||||
struct k_timer sw_wdt_timer;
|
||||
struct sw_wdt_channel sw_wdt_channels[MAX_SW_WDT_CHANNELS];
|
||||
|
||||
@@ -124,7 +124,7 @@ void start_stm32_bootloader()
|
||||
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), boot0))
|
||||
|
||||
// pin is connected to BOOT0 via resistor and capacitor
|
||||
struct device *dev = device_get_binding(DT_GPIO_LABEL(BOOT0_GPIO, gpios));
|
||||
const struct device *dev = device_get_binding(DT_GPIO_LABEL(BOOT0_GPIO, gpios));
|
||||
gpio_pin_configure(dev, DT_GPIO_PIN(BOOT0_GPIO, gpios),
|
||||
DT_GPIO_FLAGS(BOOT0_GPIO, gpios) | GPIO_OUTPUT_ACTIVE);
|
||||
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ void leds_update_thread()
|
||||
unsigned int led_count = 0;
|
||||
int flicker_count = 0;
|
||||
bool flicker_state = true;
|
||||
struct device *led_devs[NUM_LED_PINS];
|
||||
const struct device *led_devs[NUM_LED_PINS];
|
||||
|
||||
int wdt_channel = watchdog_register(1000);
|
||||
|
||||
|
||||
+3
-3
@@ -23,12 +23,12 @@
|
||||
|
||||
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), load))
|
||||
#define LOAD_GPIO DT_CHILD(DT_PATH(outputs), load)
|
||||
static struct device *dev_load;
|
||||
static const struct device *dev_load;
|
||||
#endif
|
||||
|
||||
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), usb_pwr))
|
||||
#define USB_GPIO DT_CHILD(DT_PATH(outputs), usb_pwr)
|
||||
static struct device *dev_usb;
|
||||
static const struct device *dev_usb;
|
||||
#endif
|
||||
|
||||
#include "hardware.h"
|
||||
@@ -229,7 +229,7 @@ void load_cp_enable()
|
||||
This should do the same using the Zephyr driver, but there seems to be a bug in Zephyr v2.2
|
||||
so that it doesn't work with advanced timer as TIM8. Keep it here until Zephyr bug was fixed.
|
||||
|
||||
struct device *pwm_dev;
|
||||
const struct device *pwm_dev;
|
||||
pwm_dev = device_get_binding(DT_OUTPUTS_CHARGE_PUMP_PWMS_CONTROLLER);
|
||||
if (!pwm_dev) {
|
||||
LOG_ERR("Cannot find %s!\n", DT_OUTPUTS_CHARGE_PUMP_PWMS_CONTROLLER);
|
||||
|
||||
Reference in New Issue
Block a user