Add conditional compilation for open_esplib code
This commit is contained in:
parent
4d6fa0ccfa
commit
3e5af479bc
8 changed files with 78 additions and 7 deletions
|
@ -1,11 +1,15 @@
|
|||
# Component makefile for "open sdk libs"
|
||||
# Component makefile for "open Espressif libs"
|
||||
|
||||
INC_DIRS += $(open_esplibs_ROOT)include
|
||||
|
||||
$(eval $(call component_compile_rules,open_esplibs))
|
||||
|
||||
# args for passing into compile rule generation
|
||||
opensdk_libmain_ROOT = $(opensdk_libmain_DEFAULT_ROOT)libmain
|
||||
opensdk_libmain_INC_DIR =
|
||||
opensdk_libmain_SRC_DIR = $(opensdk_libmain_ROOT)
|
||||
opensdk_libmain_EXTRA_SRC_FILES =
|
||||
open_esplibs_libmain_ROOT = $(open_esplibs_libmain_DEFAULT_ROOT)libmain
|
||||
open_esplibs_libmain_INC_DIR =
|
||||
open_esplibs_libmain_SRC_DIR = $(open_esplibs_libmain_ROOT)
|
||||
open_esplibs_libmain_EXTRA_SRC_FILES =
|
||||
|
||||
opensdk_libmain_CFLAGS = $(CFLAGS)
|
||||
open_esplibs_libmain_CFLAGS = $(CFLAGS)
|
||||
|
||||
$(eval $(call component_compile_rules,opensdk_libmain))
|
||||
$(eval $(call component_compile_rules,open_esplibs_libmain))
|
||||
|
|
36
open_esplibs/include/open_esplibs.h
Normal file
36
open_esplibs/include/open_esplibs.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef _OPEN_ESPLIBS_H
|
||||
#define _OPEN_ESPLIBS_H
|
||||
|
||||
// This header includes conditional defines to control which bits of the
|
||||
// Open-Source libraries get built when building esp-open-rtos. This can be
|
||||
// useful for quickly troubleshooting whether a bug is due to the
|
||||
// reimplementation of Espressif libraries, or something else.
|
||||
|
||||
#ifndef OPEN_ESPLIBS
|
||||
#define OPEN_ESPLIBS 1
|
||||
#endif
|
||||
|
||||
#ifndef OPEN_LIBMAIN
|
||||
#define OPEN_LIBMAIN (OPEN_ESPLIBS)
|
||||
#endif
|
||||
|
||||
#ifndef OPEN_LIBMAIN_MISC
|
||||
#define OPEN_LIBMAIN_MISC (OPEN_LIBMAIN)
|
||||
#endif
|
||||
#ifndef OPEN_LIBMAIN_OS_CPU_A
|
||||
#define OPEN_LIBMAIN_OS_CPU_A (OPEN_LIBMAIN)
|
||||
#endif
|
||||
#ifndef OPEN_LIBMAIN_SPI_FLASH
|
||||
#define OPEN_LIBMAIN_SPI_FLASH (OPEN_LIBMAIN)
|
||||
#endif
|
||||
#ifndef OPEN_LIBMAIN_TIMERS
|
||||
#define OPEN_LIBMAIN_TIMERS (OPEN_LIBMAIN)
|
||||
#endif
|
||||
#ifndef OPEN_LIBMAIN_UART
|
||||
#define OPEN_LIBMAIN_UART (OPEN_LIBMAIN)
|
||||
#endif
|
||||
#ifndef OPEN_LIBMAIN_XTENSA_CONTEXT
|
||||
#define OPEN_LIBMAIN_XTENSA_CONTEXT (OPEN_LIBMAIN)
|
||||
#endif
|
||||
|
||||
#endif /* _OPEN_ESPLIBS_H */
|
|
@ -1,3 +1,7 @@
|
|||
#include "open_esplibs.h"
|
||||
#if OPEN_LIBMAIN_MISC
|
||||
// The contents of this file are only built if OPEN_LIBMAIN_MISC is set to true
|
||||
|
||||
#include "espressif/esp_misc.h"
|
||||
#include "esp/gpio_regs.h"
|
||||
#include "esp/rtc_regs.h"
|
||||
|
@ -57,3 +61,5 @@ uint8_t sdk_rtc_get_reset_reason(void) {
|
|||
RTC.RESET_REASON0 &= ~RTC_RESET_REASON0_SOMETHING;
|
||||
return reason;
|
||||
}
|
||||
|
||||
#endif /* OPEN_LIBMAIN_MISC */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include "open_esplibs.h"
|
||||
#if OPEN_LIBMAIN_OS_CPU_A
|
||||
// The contents of this file are only built if OPEN_LIBMAIN_OS_CPU_A is set to true
|
||||
|
||||
#include "esp/types.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
@ -119,3 +123,4 @@ void IRAM sdk__xt_clear_ints(uint32_t mask) {
|
|||
WSR(mask, intclear);
|
||||
}
|
||||
|
||||
#endif /* OPEN_LIBMAIN_OS_CPU_A */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include "open_esplibs.h"
|
||||
#if OPEN_LIBMAIN_SPI_FLASH
|
||||
// The contents of this file are only built if OPEN_LIBMAIN_SPI_FLASH is set to true
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "common_macros.h"
|
||||
#include "esp/spi_regs.h"
|
||||
|
@ -181,3 +185,4 @@ sdk_SpiFlashOpResult IRAM sdk_spi_flash_read(uint32_t src_addr, uint32_t *des_ad
|
|||
return result;
|
||||
}
|
||||
|
||||
#endif /* OPEN_LIBMAIN_SPI_FLASH */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include "open_esplibs.h"
|
||||
#if OPEN_LIBMAIN_TIMERS
|
||||
// The contents of this file are only built if OPEN_LIBMAIN_TIMERS is set to true
|
||||
|
||||
#include "etstimer.h"
|
||||
#include "stdio.h"
|
||||
|
||||
|
@ -88,3 +92,4 @@ void sdk_os_timer_disarm(ETSTimer *ptimer) {
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* OPEN_LIBMAIN_TIMERS */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include "open_esplibs.h"
|
||||
#if OPEN_LIBMAIN_UART
|
||||
// The contents of this file are only built if OPEN_LIBMAIN_UART is set to true
|
||||
|
||||
#include "espressif/sdk_private.h"
|
||||
#include "esp/uart_regs.h"
|
||||
|
||||
|
@ -15,3 +19,4 @@ void sdk_Uart_Init(void) {
|
|||
/* No-Op */
|
||||
}
|
||||
|
||||
#endif /* OPEN_LIBMAIN_UART */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include "open_esplibs.h"
|
||||
#if OPEN_LIBMAIN_XTENSA_CONTEXT
|
||||
// The contents of this file are only built if OPEN_LIBMAIN_XTENSA_CONTEXT is set to true
|
||||
|
||||
.section .iram1.text, "ax", @progbits
|
||||
|
||||
.balign 4
|
||||
|
@ -39,3 +43,4 @@ sdk__xt_context_restore:
|
|||
l32i a13, sp, 64
|
||||
ret
|
||||
|
||||
#endif /* OPEN_LIBMAIN_XTENSA_CONTEXT */
|
||||
|
|
Loading…
Reference in a new issue