Skip to content

Commit f7a0f68

Browse files
committed
Update Zephyr to v3.4.0
1 parent e74bdd6 commit f7a0f68

File tree

26 files changed

+284
-1021
lines changed

26 files changed

+284
-1021
lines changed

builder/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
119119
else:
120120
target_elf = env.BuildProgram()
121121
target_firm = env.ElfToBin(join("$BUILD_DIR", "${PROGNAME}"), target_elf)
122+
123+
if "zephyr" in frameworks and "mcuboot-image" in COMMAND_LINE_TARGETS:
124+
target_firm = env.MCUbootImage(
125+
join("$BUILD_DIR", "${PROGNAME}.mcuboot.bin"), target_firm)
126+
122127
env.Depends(target_firm, "checkprogsize")
123128

124129
AlwaysBuild(env.Alias("nobuild", target_firm))

examples/zephyr-blink/src/main.c

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,43 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#include <zephyr.h>
8-
#include <device.h>
9-
#include <devicetree.h>
10-
#include <drivers/gpio.h>
7+
#include <zephyr/kernel.h>
8+
#include <zephyr/drivers/gpio.h>
119

1210
/* 1000 msec = 1 sec */
13-
#define SLEEP_TIME_MS 1000
11+
#define SLEEP_TIME_MS 300
1412

1513
/* The devicetree node identifier for the "led0" alias. */
1614
#define LED0_NODE DT_ALIAS(led0)
1715

18-
#if DT_NODE_HAS_STATUS(LED0_NODE, okay)
19-
#define LED0 DT_GPIO_LABEL(LED0_NODE, gpios)
20-
#define PIN DT_GPIO_PIN(LED0_NODE, gpios)
21-
#define FLAGS DT_GPIO_FLAGS(LED0_NODE, gpios)
22-
#else
23-
/* A build error here means your board isn't set up to blink an LED. */
24-
#error "Unsupported board: led0 devicetree alias is not defined"
25-
#define LED0 ""
26-
#define PIN 0
27-
#define FLAGS 0
28-
#endif
16+
/*
17+
* A build error on this line means your board is unsupported.
18+
* See the sample documentation for information on how to fix this.
19+
*/
20+
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
2921

3022
void main(void)
3123
{
32-
const struct device *dev;
33-
bool led_is_on = true;
3424
int ret;
3525

36-
dev = device_get_binding(LED0);
37-
if (dev == NULL) {
26+
if (!gpio_is_ready_dt(&led))
27+
{
3828
return;
3929
}
4030

41-
ret = gpio_pin_configure(dev, PIN, GPIO_OUTPUT_ACTIVE | FLAGS);
42-
if (ret < 0) {
31+
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
32+
if (ret < 0)
33+
{
4334
return;
4435
}
4536

46-
while (1) {
47-
gpio_pin_set(dev, PIN, (int)led_is_on);
48-
led_is_on = !led_is_on;
37+
while (1)
38+
{
39+
ret = gpio_pin_toggle_dt(&led);
40+
if (ret < 0)
41+
{
42+
return;
43+
}
4944
k_msleep(SLEEP_TIME_MS);
5045
}
5146
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# nothing here
1+
CONFIG_GPIO=y

examples/zephyr-cpp-synchronization/src/main.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
*/
2020

2121
#include <stdio.h>
22-
#include <zephyr.h>
23-
#include <arch/cpu.h>
24-
#include <sys/printk.h>
22+
#include <zephyr/kernel.h>
23+
#include <zephyr/arch/cpu.h>
24+
#include <zephyr/sys/printk.h>
2525

2626
/**
2727
* @class semaphore the basic pure virtual semaphore class
@@ -64,7 +64,7 @@ class cpp_semaphore: public semaphore {
6464
cpp_semaphore::cpp_semaphore()
6565
{
6666
printk("Create semaphore %p\n", this);
67-
k_sem_init(&_sema_internal, 0, UINT_MAX);
67+
k_sem_init(&_sema_internal, 0, K_SEM_MAX_LIMIT);
6868
}
6969

7070
/*
@@ -98,12 +98,9 @@ int cpp_semaphore::wait(int timeout)
9898
}
9999

100100
/**
101-
*
102101
* @brief Signal a semaphore
103102
*
104103
* This routine signals the specified semaphore.
105-
*
106-
* @return N/A
107104
*/
108105
void cpp_semaphore::give(void)
109106
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
CONFIG_CPLUSPLUS=y
2-
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=128
1+
CONFIG_CPP=y
2+
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=128

0 commit comments

Comments
 (0)