mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/macos_build_linux_target_misc' into 'master'
Misc fixes for IDF_TARGET=linux on macOS host See merge request espressif/esp-idf!28015
This commit is contained in:
commit
7265febc31
@ -121,8 +121,10 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|||||||
list(APPEND compile_options "-Wno-c2x-extensions")
|
list(APPEND compile_options "-Wno-c2x-extensions")
|
||||||
# warning on xMPU_SETTINGS for esp32s2 has size 0 for C and 1 for C++
|
# warning on xMPU_SETTINGS for esp32s2 has size 0 for C and 1 for C++
|
||||||
list(APPEND compile_options "-Wno-extern-c-compat")
|
list(APPEND compile_options "-Wno-extern-c-compat")
|
||||||
# warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
|
if(NOT (CONFIG_IDF_TARGET_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin"))
|
||||||
list(APPEND compile_options "-Wno-single-bit-bitfield-constant-conversion")
|
# warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
|
||||||
|
list(APPEND compile_options "-Wno-single-bit-bitfield-constant-conversion")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
# More warnings may exist in unit tests and example projects.
|
# More warnings may exist in unit tests and example projects.
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
idf_build_get_property(target IDF_TARGET)
|
|
||||||
|
|
||||||
set(srcs_lwip
|
set(srcs_lwip
|
||||||
"lwip/esp_netif_lwip.c"
|
"lwip/esp_netif_lwip.c"
|
||||||
"lwip/esp_netif_sntp.c"
|
"lwip/esp_netif_sntp.c"
|
||||||
@ -17,12 +15,6 @@ set(srcs
|
|||||||
set(include_dirs "include")
|
set(include_dirs "include")
|
||||||
set(priv_include_dirs "private_include")
|
set(priv_include_dirs "private_include")
|
||||||
|
|
||||||
idf_build_get_property(target IDF_TARGET)
|
|
||||||
if(${target} STREQUAL "linux")
|
|
||||||
list(APPEND include_dirs
|
|
||||||
"linux/stubs/include")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CONFIG_PPP_SUPPORT)
|
if(CONFIG_PPP_SUPPORT)
|
||||||
list(APPEND srcs_lwip lwip/esp_netif_lwip_ppp.c lwip/netif/ppp.c)
|
list(APPEND srcs_lwip lwip/esp_netif_lwip_ppp.c lwip/netif/ppp.c)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include_next <endian.h>
|
|
@ -4,7 +4,7 @@ if(NOT "${target}" STREQUAL "linux")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
list(APPEND srcs getrandom.c)
|
list(APPEND srcs getrandom.c assert_func.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
idf_component_register(INCLUDE_DIRS include
|
idf_component_register(INCLUDE_DIRS include
|
||||||
|
23
components/linux/assert_func.c
Normal file
23
components/linux/assert_func.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "hal/assert.h"
|
||||||
|
|
||||||
|
// Implementation of __assert_func for macOS.
|
||||||
|
void __assert_func(const char *file, int line, const char *func, const char *expr)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "assert failed at %s:%d (%s): %s\n", file, line, func, expr);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defining this symbol as well, since `hal` component will add "-U __assert_func" linker option,
|
||||||
|
// and symbols are prefixed with an additional underscore on macOS.
|
||||||
|
// (Can't use __attribute__((alias)) because aliases are not supported on macOS.)
|
||||||
|
void _assert_func(const char *file, int line, const char *func, const char *expr)
|
||||||
|
{
|
||||||
|
__assert_func(file, line, func, expr);
|
||||||
|
}
|
11
components/linux/include/machine/endian.h
Normal file
11
components/linux/include/machine/endian.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#if __APPLE__
|
||||||
|
#include_next <machine/endian.h>
|
||||||
|
#else
|
||||||
|
#include <endian.h>
|
||||||
|
#endif
|
@ -71,7 +71,9 @@ endif()
|
|||||||
append_line(" */")
|
append_line(" */")
|
||||||
|
|
||||||
append_line(".data")
|
append_line(".data")
|
||||||
|
append_line("#if !defined (__APPLE__) && !defined (__linux__)")
|
||||||
append_line(".section .rodata.embedded")
|
append_line(".section .rodata.embedded")
|
||||||
|
append_line("#endif")
|
||||||
make_and_append_identifier("${varname}")
|
make_and_append_identifier("${varname}")
|
||||||
make_and_append_identifier("_binary_${varname}_start" "for objcopy compatibility")
|
make_and_append_identifier("_binary_${varname}_start" "for objcopy compatibility")
|
||||||
append("${data}")
|
append("${data}")
|
||||||
|
Loading…
Reference in New Issue
Block a user