diff --git a/README.md b/README.md index 106dbfe..d41210a 100644 --- a/README.md +++ b/README.md @@ -4,36 +4,33 @@ This repository contains presentations for Zarhus Developer Meetups. ## Installation -1. Install the `slidev-template` submodule: - `git submodule update --init --remote slidev-template` +Install the `slidev-template` submodule: -2. Go to the submodule directory: - `cd slidev-template` +```bash +git submodule update --init --remote slidev-template +``` ## Usage ### Start presentation -1. Start the desired presentation: - `./scripts/local-preview.sh ../pages/ram-wipe.md` +Start the desired presentation: -2. Open content in browser on +```bash +./scripts/local-preview.sh ../pages/ram-wipe.md +``` -### Export presentation - -1. Start the desired presentation: - `./scripts/generate-pdf.sh ../pages/ram-wipe.md` +Then open content in browser on ## Contribution -* Please feel free to create issues for improvement ideas and bugs, as well as - pull requests to fix any issues. -* If you intend to provide code improvements, please install all dependencies - by running: +Please feel free to create issues for improvement ideas and bugs, as well as +pull requests to fix any issues. If you intend to provide code improvements, +please install all dependencies by running: - ```bash - pip install -r requirements.txt - ``` +```bash +pip install -r requirements.txt +``` -* Before pushing code for review, ensure that `pre-commit run --all-files` does - not return any issues. +Before pushing code for review, ensure that `pre-commit run --all-files` does +not return any issues. diff --git a/img/dhcp-crosscon-zdm.png b/img/dhcp-crosscon-zdm.png new file mode 100644 index 0000000..781c38f Binary files /dev/null and b/img/dhcp-crosscon-zdm.png differ diff --git a/img/hv-wifi-app.png b/img/hv-wifi-app.png new file mode 100644 index 0000000..61e122d Binary files /dev/null and b/img/hv-wifi-app.png differ diff --git a/img/lpc.jpg b/img/lpc.jpg new file mode 100644 index 0000000..556916d Binary files /dev/null and b/img/lpc.jpg differ diff --git a/img/wifi_click.jpg b/img/wifi_click.jpg new file mode 100644 index 0000000..34669d9 Binary files /dev/null and b/img/wifi_click.jpg differ diff --git a/img/zdm-2-logo-crosscon-hyp-dhcp-demo.png b/img/zdm-2-logo-crosscon-hyp-dhcp-demo.png new file mode 100644 index 0000000..71dfa16 Binary files /dev/null and b/img/zdm-2-logo-crosscon-hyp-dhcp-demo.png differ diff --git a/pages/zdm_2/zephyr-wifi.md b/pages/zdm_2/zephyr-wifi.md new file mode 100644 index 0000000..4161e07 --- /dev/null +++ b/pages/zdm_2/zephyr-wifi.md @@ -0,0 +1,387 @@ +--- +theme: ../slidev-template/theme +layout: cover +background: /intro.png +class: text-center +--- + +## Launching Wi-Fi DHCP client Zephyr application on top of the the CROSSCON Hypervisor + +
+ +
+ + + +--- +layout: two-cols-header +--- + +## Who am I? + +::left:: + +
+ +
+ + + +**Daniil Klimuk** + +_Zarhus team leader, embedded and Linux enthusiast_ + + : [3mdeb.com](https://3mdeb.com) + +
+ +::right:: + +
+ +
+ + + +--- +layout: two-cols-header +--- + +## Agenda + +::left:: + +- The CROSSCON Project +- The CROSSCON Hypervisor +- The Zephyr RTOS demo +- Implementation +- The results +- Q&A + +::right:: + +
+ +
+ + + +--- +layout: two-cols-header +--- + +### The CROSSCON Project + +::left:: + +- A project that focuses on security for IoT devices +- More information: + * CROSSCON, its Hypervisor, and Zarhus blog post + * Linkedin: + * Website: + * GitHub: + +



+ +::right:: + +
+ +
+ + + +--- +layout: two-cols-header +--- + +### The CROSSCON Hypervisor + +::left:: + +Features: +- A static partitioning hypervisor + * Static CPU cores assignment + * Static interrupts assignment + * Static memory and devices assignment +- Has a scheduler for platforms with one CPU +- ARM TrustZone and SGX enclaves TEE emulation +- Multiple TEE support +- Support for multiple architectures, including ARM and RISC-V + +GitHub: + +



+ +::right:: + +
+ +
+ + + +--- +layout: two-cols-header +--- + +## The Zephyr RTOS demo + +::left:: + +The goals: +- To run a Zephyr RTOS application with some network device access inside the + CROSSCON Hypervisor virtual machine on LPCXpresso55S69 (the VM1 from the + diagram above). +- To run two CROSSCON Hypervisor virtual machines side-by-side on + LPCXpresso55S69, where one virtual machine runs some bare-metal application + (the VM0 from the diagram above) and the second one runs the application from + the first goal. + +

+ +::right:: + +
+ +
+ +--- +layout: two-cols-header +--- + +## The Zephyr RTOS demo + +::left:: + +Prerequisites: +- LPCXpresso55S69 board with additional UART converters. +- MIKROE-2542 Wi-FI module. +- Zephyr RTOS DHCP client demo. +- Some Zephyr RTOS development experience. + +::right:: + +
+ +
+ +

+ + + +--- +layout: two-cols-header +--- + +## The Zephyr RTOS demo + +::left:: + +The things to consider when launching smth. on top of the CROSSCON Hypervisor: +- Set the application entry and load addresses. +- Assign memory to the virtual machine in which the application will be running. +- Assign memory and interrupts to the memory-mapped peripherals. + +::right:: + +
+ +
+ +




+ +--- + +## VM entry point + +The binary's entry point can be read using `readelf`: + +```bash +readelf -aW zephyr.elf | grep __start + 4942: 00045b15 0 FUNC GLOBAL DEFAULT 2 __start +``` + +It has to be equal to the VM's entry point plus 1. + +```c +/* ZEPHYR VM */ +.image = VM_IMAGE_LOADED(0x00040000, 0x00040000, 0x30000), +.entry = 0x00045b14, +``` + +--- + +## VM memory assignment + +Two memory address ranges should be reserved, SRAM and FLASH: + +```c +(...) +.regions = (struct vm_mem_region[]) { + { + .base = 0x20020000, //SRAM + .size = 0x10000 + }, + { + .base = 0x00040000, //FLASH + .size = 0x10000 + } +}, +(...) +``` + +--- + +## VM devices assignment + +In the Hypervisor config: + +```diff +@@ -102,6 +102,12 @@ struct config config = { ++ { ++ /* RNG */ ++ .pa = 0x4003a000, ++ .va = 0x4003a000, ++ .size = 0x1000, ++ }, + }, + .ipc_num = 1, + .ipcs = (struct ipc[]) { +``` + +Assign the RNG to the VM. No Zephyr RTOS devicetree changes needed. + +--- + +## VM devices assignment + +Separate UART interfaces had to be set up for the Wi-Fi module and console logs. + +```diff +@@ -30,9 +30,9 @@ +- zephyr,uart-mcumgr = &flexcomm2; +- zephyr,console = &flexcomm2; +- zephyr,shell-uart = &flexcomm2; ++ zephyr,uart-mcumgr = &flexcomm3; ++ zephyr,console = &flexcomm3; ++ zephyr,shell-uart = &flexcomm3; + zephyr,entropy = &rng; + }; + +@@ -84,6 +84,10 @@ ++&flexcomm3 { ++ status = "okay"; ++}; ++ +``` + +--- + +## VM devices assignment + +After reassingning the UART in the Zephyr RTOS device tree change the CROSSCON +Hypervisor configuration: + +```diff +(...) +.devs = (struct vm_dev_region[]) { + { + /* Flexcomm Interface 2 (USART2) */ + /* AND */ + /* Flexcomm Interface 3 (USART3) */ + .pa = 0x40088000, + .va = 0x40088000, + .size = 0x2000, + .interrupt_num = 2, + .interrupts = (irqid_t[]) {16+16, 17+16} + }, +(...) +``` + +--- +layout: two-cols-header +--- + +## The results + +::left:: + +- After some problems with the CROSSCON Hypervisor scheduler and ARM +TrustZone SAU component, we managed to run the application! +- Check out page for the blog post that will cover this +topic in depth. + +::right:: + +
+ +

+ +--- +layout: cover +background: /intro.png +class: text-center +--- + +## Q&A + +
+ +