Skip to content

Commit 5ebd202

Browse files
updata code
1 parent aff9d95 commit 5ebd202

24 files changed

+982
-284
lines changed

extmod/extmod.cmake

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set(MICROPY_SOURCE_EXTMOD
1111
${MICROPY_EXTMOD_DIR}/machine_adc_block.c
1212
${MICROPY_EXTMOD_DIR}/machine_bitstream.c
1313
${MICROPY_EXTMOD_DIR}/machine_i2c.c
14+
${MICROPY_EXTMOD_DIR}/machine_i2c_target.c
1415
${MICROPY_EXTMOD_DIR}/machine_i2s.c
1516
${MICROPY_EXTMOD_DIR}/machine_mem.c
1617
${MICROPY_EXTMOD_DIR}/machine_pulse.c
@@ -105,60 +106,60 @@ set(MICROPY_SOURCE_LIB_LIBM_SQRT_HW ${MICROPY_DIR}/lib/libm/thumb_vfp_sqrtf.c)
105106

106107
# Library for btree module and associated code
107108

108-
if(MICROPY_PY_BTREE)
109-
set(MICROPY_LIB_BERKELEY_DIR "${MICROPY_DIR}/lib/berkeley-db-1.xx")
110-
list(APPEND GIT_SUBMODULES lib/berkeley-db-1.xx)
111109

112-
if(NOT UPDATE_SUBMODULES AND NOT EXISTS ${MICROPY_LIB_BERKELEY_DIR}/README)
113-
# Regular build, submodule not initialised -- fail with a clear error.
114-
message(FATAL_ERROR " MICROPY_PY_BTREE is enabled but the berkeley-db submodule is not initialised.\n Run 'make BOARD=${MICROPY_BOARD} submodules'")
115-
endif()
110+
set(MICROPY_LIB_BERKELEY_DIR "${MICROPY_DIR}/lib/berkeley-db-1.xx")
111+
list(APPEND GIT_SUBMODULES lib/berkeley-db-1.xx)
116112

117-
add_library(micropy_extmod_btree OBJECT
118-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c
119-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_conv.c
120-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_debug.c
121-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_delete.c
122-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_get.c
123-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_open.c
124-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_overflow.c
125-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_page.c
126-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_put.c
127-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_search.c
128-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_seq.c
129-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_split.c
130-
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_utils.c
131-
${MICROPY_LIB_BERKELEY_DIR}/mpool/mpool.c
132-
)
113+
if(NOT UPDATE_SUBMODULES AND NOT EXISTS ${MICROPY_LIB_BERKELEY_DIR}/README)
114+
# Regular build, submodule not initialised -- fail with a clear error.
115+
message(FATAL_ERROR " MICROPY_PY_BTREE is enabled but the berkeley-db submodule is not initialised.\n Run 'make BOARD=${MICROPY_BOARD} submodules'")
116+
endif()
133117

134-
target_include_directories(micropy_extmod_btree PRIVATE
135-
${MICROPY_LIB_BERKELEY_DIR}/include
136-
)
118+
add_library(micropy_extmod_btree OBJECT
119+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c
120+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_conv.c
121+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_debug.c
122+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_delete.c
123+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_get.c
124+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_open.c
125+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_overflow.c
126+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_page.c
127+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_put.c
128+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_search.c
129+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_seq.c
130+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_split.c
131+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_utils.c
132+
${MICROPY_LIB_BERKELEY_DIR}/mpool/mpool.c
133+
)
137134

138-
if(NOT BERKELEY_DB_CONFIG_FILE)
139-
set(BERKELEY_DB_CONFIG_FILE "${MICROPY_DIR}/extmod/berkeley-db/berkeley_db_config_port.h")
140-
endif()
135+
target_include_directories(micropy_extmod_btree PRIVATE
136+
${MICROPY_LIB_BERKELEY_DIR}/include
137+
)
141138

142-
target_compile_definitions(micropy_extmod_btree PRIVATE
143-
BERKELEY_DB_CONFIG_FILE="${BERKELEY_DB_CONFIG_FILE}"
144-
)
139+
if(NOT BERKELEY_DB_CONFIG_FILE)
140+
set(BERKELEY_DB_CONFIG_FILE "${MICROPY_DIR}/extmod/berkeley-db/berkeley_db_config_port.h")
141+
endif()
142+
143+
target_compile_definitions(micropy_extmod_btree PRIVATE
144+
BERKELEY_DB_CONFIG_FILE="${BERKELEY_DB_CONFIG_FILE}"
145+
)
145146

146-
# The include directories and compile definitions below are needed to build
147-
# modbtree.c and should be added to the main MicroPython target.
147+
# The include directories and compile definitions below are needed to build
148+
# modbtree.c and should be added to the main MicroPython target.
148149

149-
list(APPEND MICROPY_INC_CORE
150-
"${MICROPY_LIB_BERKELEY_DIR}/include"
151-
)
150+
list(APPEND MICROPY_INC_CORE
151+
"${MICROPY_LIB_BERKELEY_DIR}/include"
152+
)
152153

153-
list(APPEND MICROPY_DEF_CORE
154-
MICROPY_PY_BTREE=1
155-
BERKELEY_DB_CONFIG_FILE="${BERKELEY_DB_CONFIG_FILE}"
156-
)
154+
list(APPEND MICROPY_DEF_CORE
155+
MICROPY_PY_BTREE=1
156+
BERKELEY_DB_CONFIG_FILE="${BERKELEY_DB_CONFIG_FILE}"
157+
)
158+
159+
list(APPEND MICROPY_SOURCE_EXTMOD
160+
${MICROPY_EXTMOD_DIR}/modbtree.c
161+
)
157162

158-
list(APPEND MICROPY_SOURCE_EXTMOD
159-
${MICROPY_EXTMOD_DIR}/modbtree.c
160-
)
161-
endif()
162163

163164
# Library for mbedtls
164165

extmod/extmod.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ SRC_EXTMOD_C += \
66
extmod/machine_adc_block.c \
77
extmod/machine_bitstream.c \
88
extmod/machine_i2c.c \
9+
extmod/machine_i2c_target.c \
910
extmod/machine_i2s.c \
1011
extmod/machine_mem.c \
1112
extmod/machine_pinbase.c \

0 commit comments

Comments
 (0)