samples: ipm_esp32: use net core source from build ouput

Current ipm_esp32 sample code requires esp32_net_firmware.c file
as source input, which is generated after ipm_esp32_net build.
esp32_net_firmware.c was manually added as binary blob, which needs to
be removed from the repository.

This change modifies ipm_esp32 CMakeLists.txt to include the build
output of ipm_esp32_net as input source of ipm_esp32 build, allowing the
binary blob to be removed.

Current approach shall be updated during next release.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
This commit is contained in:
Sylvio Alves 2023-02-16 00:52:43 -03:00 committed by Stephanos Ioannidis
parent 57e6532b0a
commit f433e95262
2 changed files with 26 additions and 8 deletions

View file

@ -2,7 +2,23 @@
cmake_minimum_required(VERSION 3.20.0)
set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/ipm_esp32_net-prefix/src/ipm_esp32_net-build/zephyr)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(ipm_esp32)
target_sources(app PRIVATE src/main.c src/esp32_net_firmware.c)
set_source_files_properties(${REMOTE_ZEPHYR_DIR}/esp32_net_firmware.c PROPERTIES GENERATED TRUE)
target_sources(app PRIVATE src/main.c ${REMOTE_ZEPHYR_DIR}/esp32_net_firmware.c)
include(ExternalProject)
ExternalProject_Add(
ipm_esp32_net
SOURCE_DIR ${APPLICATION_SOURCE_DIR}/ipm_esp32_net
INSTALL_COMMAND ""
CMAKE_CACHE_ARGS -DBOARD:STRING=esp32_net
BUILD_BYPRODUCTS "${REMOTE_ZEPHYR_DIR}/${KERNEL_BIN_NAME}"
BUILD_ALWAYS True
)
add_dependencies(app ipm_esp32_net)

View file

@ -21,21 +21,23 @@ messages in chunks of 64bytes.
Building and Running the Zephyr Code
************************************
The sample requires two build commands to run, first of all
you need to build the esp32_net firmware as follows:
Build the ESP32 IPM sample code as follows:
.. zephyr-app-commands::
:zephyr-app: samples/drivers/ipm/ipm_esp32/ipm_esp32_net
:board: esp32_net
:zephyr-app: samples/drivers/ipm/ipm_esp32
:board: esp32
:goals: build
:compact:
Copy output file build/zephyr/esp32_net_firmware.c to samples/drivers/ipm/ipm_esp32/src,
then build the main project and flash as stated earlier, and you would see the following output:
Sample Output
*************
To check the output of this sample, run ``west espressif monitor`` or any other serial
console program (e.g., minicom, putty, screen, etc).
.. code-block:: console
*** Booting Zephyr OS build zephyr-v3.0.0-1911-g610f489c861e ***
*** Booting Zephyr OS build v3.3.0-rc3-38-gc9225e4365b9 ***
PRO_CPU is sending a fake request, waiting remote response...
PRO_CPU received a message from APP_CPU : APP_CPU: This is a response
PRO_CPU is sending a fake request, waiting remote response...