From 47595b1c10c8af78e9ec8611d2b5ef48c538e8c2 Mon Sep 17 00:00:00 2001 From: Ramakrishna Pallala Date: Tue, 12 Dec 2017 11:05:52 -0500 Subject: [PATCH] boards: nios2: fix nios2 flashing issue 'make flash' is failing for altera_max10 board due to the missing NIOS2_CPU_SOF environment variable. Though it is set in arch/nios2/soc/nios2f-zephyr/CMakeLists.txt but it is not taking effect when flashing script is run. The reason could be following which is mentioned in https://itk.org/Wiki/CMake_FAQ "environment variables SET in the CMakeLists.txt only take effect for cmake itself (configure-time), so you cannot use this method to set an environment variable that a custom command might need (build-time)." Now, NIOS2_CPU_SOF is set from boards/nios2/altera_max10/board.cmake file which is more logical because all the FLASH related environment variables are being set from board.cmake Signed-off-by: Ramakrishna Pallala --- arch/nios2/soc/nios2f-zephyr/CMakeLists.txt | 2 -- boards/nios2/altera_max10/board.cmake | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/nios2/soc/nios2f-zephyr/CMakeLists.txt b/arch/nios2/soc/nios2f-zephyr/CMakeLists.txt index 92d5edf45a9..e69de29bb2d 100644 --- a/arch/nios2/soc/nios2f-zephyr/CMakeLists.txt +++ b/arch/nios2/soc/nios2f-zephyr/CMakeLists.txt @@ -1,2 +0,0 @@ - -set($ENV{NIOS2_CPU_SOF} $ENV{ZEPHYR_BASE}/arch/nios2/soc/nios2f-zephyr/cpu/ghrd_10m50da.sof) diff --git a/boards/nios2/altera_max10/board.cmake b/boards/nios2/altera_max10/board.cmake index ba1aef2513d..46e36a3c8b1 100644 --- a/boards/nios2/altera_max10/board.cmake +++ b/boards/nios2/altera_max10/board.cmake @@ -1,2 +1,4 @@ set(FLASH_SCRIPT nios2.sh) set(DEBUG_SCRIPT nios2.sh) +set(NIOS2_CPU_SOF $ENV{ZEPHYR_BASE}/arch/nios2/soc/nios2f-zephyr/cpu/ghrd_10m50da.sof) +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS NIOS2_CPU_SOF)