mpconfigport.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. /*
  2. * This file is part of the MicroPython project, http://micropython.org/
  3. *
  4. * The MIT License (MIT)
  5. *
  6. * Copyright (c) 2017 Armink (armink.ztl@gmail.com)
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. */
  26. #include <rthw.h>
  27. #include <rtthread.h>
  28. #include <stdint.h>
  29. #include <stdio.h>
  30. // options to control how MicroPython is built
  31. // You can disable the built-in MicroPython compiler by setting the following
  32. // config option to 0. If you do this then you won't get a REPL prompt, but you
  33. // will still be able to execute pre-compiled scripts, compiled with mpy-cross.
  34. #define MICROPY_ENABLE_COMPILER (1)
  35. #if defined(PKG_MICROPYTHON_HEAP_SIZE)
  36. #define MICROPY_HEAP_SIZE PKG_MICROPYTHON_HEAP_SIZE
  37. #else
  38. #define MICROPY_HEAP_SIZE (8 * 1024)
  39. #endif
  40. #define MP_ENDIANNESS_LITTLE (1)
  41. #define MICROPY_STACK_CHECK (1)
  42. #define MICROPY_PY_MICROPYTHON_STACK_USE (1)
  43. #define MICROPY_QSTR_BYTES_IN_HASH (1)
  44. #define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool
  45. #define MICROPY_ALLOC_PATH_MAX (256)
  46. #define MICROPY_ALLOC_PARSE_CHUNK_INIT (16)
  47. #define MICROPY_EMIT_X64 (0)
  48. #define MICROPY_EMIT_THUMB (0)
  49. #define MICROPY_EMIT_INLINE_THUMB (0)
  50. #define MICROPY_COMP_MODULE_CONST (0)
  51. #define MICROPY_COMP_CONST (0)
  52. #define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (0)
  53. #define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (0)
  54. #define MICROPY_MEM_STATS (0)
  55. #define MICROPY_DEBUG_PRINTERS (0)
  56. #define MICROPY_ENABLE_GC (1)
  57. #define MICROPY_ENABLE_FINALISER (1)
  58. #define MICROPY_GC_ALLOC_THRESHOLD (0)
  59. #define MICROPY_REPL_EVENT_DRIVEN (0)
  60. #define MICROPY_REPL_AUTO_INDENT (1)
  61. #define MICROPY_KBD_EXCEPTION (1)
  62. #define MICROPY_HELPER_REPL (1)
  63. #define MICROPY_HELPER_LEXER_UNIX (0)
  64. #define MICROPY_ENABLE_SOURCE_LINE (0)
  65. #define MICROPY_ENABLE_DOC_STRING (0)
  66. #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
  67. #define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
  68. #define MICROPY_PY_ASYNC_AWAIT (0)
  69. // control over Python builtins
  70. #define MICROPY_PY_FUNCTION_ATTRS (1)
  71. #define MICROPY_PY_BUILTINS_STR_UNICODE (1)
  72. #define MICROPY_PY_BUILTINS_STR_CENTER (1)
  73. #define MICROPY_PY_BUILTINS_STR_PARTITION (1)
  74. #define MICROPY_PY_BUILTINS_STR_SPLITLINES (1)
  75. #define MICROPY_PY_BUILTINS_BYTEARRAY (1)
  76. #define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
  77. #define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
  78. #define MICROPY_PY_ALL_SPECIAL_METHODS (1)
  79. #define MICROPY_PY_BUILTINS_INPUT (1)
  80. #define MICROPY_PY_BUILTINS_POW3 (1)
  81. #define MICROPY_PY_BUILTINS_ENUMERATE (1)
  82. #define MICROPY_PY_BUILTINS_FILTER (1)
  83. #define MICROPY_PY_BUILTINS_FROZENSET (1)
  84. #define MICROPY_PY_BUILTINS_REVERSED (1)
  85. #define MICROPY_PY_BUILTINS_SET (1)
  86. #define MICROPY_PY_BUILTINS_HELP (1)
  87. #define MICROPY_PY_BUILTINS_HELP_TEXT rtthread_help_text
  88. #define MICROPY_PY_BUILTINS_HELP_MODULES (1)
  89. #define MICROPY_PY_BUILTINS_SLICE (1)
  90. #define MICROPY_PY_BUILTINS_PROPERTY (1)
  91. #define MICROPY_PY_BUILTINS_MIN_MAX (1)
  92. #define MICROPY_PY___FILE__ (1)
  93. #define MICROPY_PY_GC (1)
  94. #define MICROPY_PY_ARRAY (1)
  95. #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
  96. #define MICROPY_PY_ATTRTUPLE (1)
  97. #define MICROPY_PY_COLLECTIONS (1)
  98. #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
  99. #define MICROPY_PY_MATH (1)
  100. #define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (1)
  101. #define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
  102. #define MICROPY_STREAMS_NON_BLOCK (1)
  103. #define MICROPY_MODULE_WEAK_LINKS (1)
  104. #define MICROPY_CAN_OVERRIDE_BUILTINS (1)
  105. #define MICROPY_USE_INTERNAL_ERRNO (1)
  106. #define MICROPY_USE_INTERNAL_PRINTF (0)
  107. #define MICROPY_PY_STRUCT (1)
  108. #define MICROPY_PY_SYS (1)
  109. #define MICROPY_MODULE_FROZEN_MPY (1)
  110. #define MICROPY_CPYTHON_COMPAT (1)
  111. #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
  112. #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
  113. #define MICROPY_READER_VFS (0)
  114. #define MICROPY_PY_PIN (1)
  115. #define MICROPY_PY_OS_DUPTERM (1)
  116. #define MICROPY_VFS (0)
  117. #define MICROPY_VFS_FAT (0)
  118. #define MICROPY_PY_UTIME (1)
  119. #define MICROPY_PY_MACHINE (1)
  120. #define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new
  121. #define MICROPY_PY_UTIME_MP_HAL (1)
  122. #define MICROPY_PY_UTIMEQ (1)
  123. #define MICROPY_PY_RTTHREAD (1)
  124. /*****************************************************************************/
  125. /* Hardware Module */
  126. #ifdef MICROPYTHON_USING_MACHINE_I2C
  127. #define MICROPY_PY_MACHINE_I2C (1)
  128. #define MICROPY_PY_MACHINE_I2C_MAKE_NEW machine_hard_i2c_make_new
  129. #endif
  130. #ifdef MICROPYTHON_USING_MACHINE_SPI
  131. #define MICROPY_PY_MACHINE_SPI (1)
  132. #define MICROPY_PY_MACHINE_SPI_MAKE_NEW machine_hard_spi_make_new
  133. #endif
  134. #ifdef MICROPYTHON_USING_MACHINE_UART
  135. #define MICROPY_PY_MACHINE_UART (1)
  136. #endif
  137. /*****************************************************************************/
  138. /* System Module */
  139. #ifdef MICROPYTHON_USING_UOS
  140. #define MICROPY_PY_IO (1)
  141. #define MICROPY_PY_IO_FILEIO (1)
  142. #define MICROPY_PY_MODUOS (1)
  143. #define MICROPY_PY_MODUOS_FILE (1)
  144. #define MICROPY_PY_SYS_STDFILES (1)
  145. #define MICROPY_READER_POSIX (1)
  146. #define MICROPY_PY_BUILTINS_COMPILE (1)
  147. #define MICROPY_PY_BUILTINS_EXECFILE (1)
  148. #else
  149. #define MICROPY_PY_IO (0)
  150. #define MICROPY_PY_MODUOS (0)
  151. #endif /* MICROPYTHON_USING_UOS */
  152. #ifdef MICROPYTHON_USING_THREAD
  153. #define MICROPY_PY_THREAD (1)
  154. #define MICROPY_ENABLE_SCHEDULER (1)
  155. #define MICROPY_SCHEDULER_DEPTH (8)
  156. #endif /* MICROPYTHON_USING_THREAD */
  157. #ifdef MICROPYTHON_USING_USELECT
  158. #define MICROPY_PY_USELECT (1)
  159. #endif
  160. #ifdef MICROPYTHON_USING_UCTYPES
  161. #define MICROPY_PY_UCTYPES (1)
  162. #endif
  163. #ifdef MICROPYTHON_USING_UERRNO
  164. #define MICROPY_PY_UERRNO (1)
  165. #endif
  166. /*****************************************************************************/
  167. /* Tools Module */
  168. #ifdef MICROPYTHON_USING_CMATH
  169. #define MICROPY_PY_CMATH (1)
  170. #endif
  171. #ifdef MICROPYTHON_USING_UBINASCII
  172. #define MICROPY_PY_UBINASCII (1)
  173. #endif
  174. #ifdef MICROPYTHON_USING_UHASHLIB
  175. #define MICROPY_PY_UHASHLIB (1)
  176. #endif
  177. #ifdef MICROPYTHON_USING_UHEAPQ
  178. #define MICROPY_PY_UHEAPQ (1)
  179. #endif
  180. #ifdef MICROPYTHON_USING_UJSON
  181. #define MICROPY_PY_UJSON (1)
  182. #endif
  183. #ifdef MICROPYTHON_USING_URE
  184. #define MICROPY_PY_URE (1)
  185. #endif
  186. #ifdef MICROPYTHON_USING_UZLIB
  187. #define MICROPY_PY_UZLIB (1)
  188. #endif
  189. #ifdef MICROPYTHON_USING_URANDOM
  190. #define MICROPY_PY_URANDOM (1)
  191. #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
  192. #endif
  193. /*****************************************************************************/
  194. /* Network Module */
  195. #ifdef MICROPYTHON_USING_USOCKET
  196. #define MICROPY_PY_USOCKET (1)
  197. #endif
  198. #ifdef MICROPYTHON_USING_USSL
  199. #define MICROPY_PY_USSL (1)
  200. #define MICROPY_SSL_MBEDTLS (1)
  201. #endif
  202. #if MICROPY_PY_THREAD
  203. #define MICROPY_EVENT_POLL_HOOK \
  204. do { \
  205. extern void mp_handle_pending(void); \
  206. mp_handle_pending(); \
  207. MP_THREAD_GIL_EXIT(); \
  208. MP_THREAD_GIL_ENTER(); \
  209. } while (0);
  210. #else
  211. #define MICROPY_EVENT_POLL_HOOK \
  212. do { \
  213. extern void mp_handle_pending(void); \
  214. mp_handle_pending(); \
  215. rt_thread_delay(1); \
  216. } while (0);
  217. #endif
  218. #if defined(__CC_ARM)
  219. #include <sys/types.h>
  220. #define MICROPY_NO_ALLOCA 1
  221. #define MP_WEAK RT_WEAK
  222. #define MP_NOINLINE
  223. #define MP_ALWAYSINLINE
  224. #define MP_LIKELY(x) x
  225. #define MP_UNLIKELY(x) x
  226. #undef __arm__
  227. #undef __thumb__
  228. #undef __thumb2__
  229. #elif defined(__ICCARM__)
  230. #include <libc/libc_errno.h>
  231. #include <sys/types.h>
  232. #define MICROPY_NO_ALLOCA 1
  233. #define NORETURN __noreturn
  234. #define MP_WEAK RT_WEAK
  235. #define MP_NOINLINE
  236. #define MP_ALWAYSINLINE
  237. #define MP_LIKELY(x) x
  238. #define MP_UNLIKELY(x) x
  239. #elif defined(__GNUC__)
  240. // We need to provide a declaration/definition of alloca()
  241. #include <alloca.h>
  242. #else
  243. #error "not supported compiler"
  244. #endif /* defined(__CC_ARM) */
  245. // type definitions for the specific machine
  246. #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
  247. // This port is intended to be 32-bit, but unfortunately, int32_t for
  248. // different targets may be defined in different ways - either as int
  249. // or as long. This requires different printf formatting specifiers
  250. // to print such value. So, we avoid int32_t and use int directly.
  251. #define UINT_FMT "%u"
  252. #define INT_FMT "%d"
  253. typedef int mp_int_t; // must be pointer size
  254. typedef unsigned mp_uint_t; // must be pointer size
  255. typedef long mp_off_t;
  256. #define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_stream(str, len)
  257. #define MICROPY_PY_SYS_PLATFORM "rt-thread"
  258. #define MICROPY_HW_BOARD_NAME "Universal python platform"
  259. #define MICROPY_HW_MCU_NAME "RT-Thread"
  260. #define MICROPY_PY_PATH "/libs/mpy/"
  261. #define MICROPY_BEGIN_ATOMIC_SECTION() rt_hw_interrupt_disable()
  262. #define MICROPY_END_ATOMIC_SECTION(state) rt_hw_interrupt_enable(state)
  263. #ifdef __linux__
  264. #define MICROPY_MIN_USE_STDOUT (1)
  265. #endif
  266. #define MP_STATE_PORT MP_STATE_VM
  267. #define MICROPY_PORT_ROOT_POINTERS const char *readline_hist[8];
  268. extern const struct _mp_obj_module_t pyb_module;
  269. extern const struct _mp_obj_module_t mp_module_rtthread;
  270. extern const struct _mp_obj_module_t mp_module_time;
  271. extern const struct _mp_obj_module_t mp_module_machine;
  272. extern const struct _mp_obj_module_t mp_module_uos;
  273. extern const struct _mp_obj_module_t mp_module_uselect;
  274. extern const struct _mp_obj_module_t mp_module_usocket;
  275. extern const struct _mp_obj_module_t mp_module_io;
  276. extern const struct _mp_obj_fun_builtin_fixed_t machine_soft_reset_obj;
  277. #if MICROPY_PY_RTTHREAD
  278. #define RTTHREAD_PORT_BUILTIN_MODULES { MP_ROM_QSTR(MP_QSTR_rtthread), MP_ROM_PTR(&mp_module_rtthread) },
  279. #else
  280. #define RTTHREAD_PORT_BUILTIN_MODULES
  281. #endif /* MICROPY_PY_RTTHREAD */
  282. #if MICROPY_PY_MODUOS
  283. #define MODUOS_PORT_BUILTINS { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
  284. #define MODUOS_PORT_BUILTIN_MODULES { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) },
  285. #define MODUOS_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_os), MP_ROM_PTR(&mp_module_uos) },
  286. #define mp_import_stat(x) mp_posix_import_stat(x)
  287. #else
  288. #define MODUOS_PORT_BUILTINS
  289. #define MODUOS_PORT_BUILTIN_MODULES
  290. #define MODUOS_PORT_BUILTIN_MODULE_WEAK_LINKS
  291. #endif /* MICROPY_PY_MODUOS */
  292. #if MICROPY_PY_USOCKET
  293. #define SOCKET_PORT_BUILTIN_MODULES { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_usocket) },
  294. #define SOCKET_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&mp_module_usocket) },
  295. #else
  296. #define SOCKET_PORT_BUILTIN_MODULES
  297. #define SOCKET_PORT_BUILTIN_MODULE_WEAK_LINKS
  298. #endif /* MICROPY_PY_USOCKET */
  299. #ifdef MICROPYTHON_USING_UBINASCII
  300. #define MODUBINASCII_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) },
  301. #else
  302. #define MODUBINASCII_PORT_BUILTIN_MODULE_WEAK_LINKS
  303. #endif /* MICROPY_PY_UBINASCII */
  304. #ifdef MICROPY_PY_COLLECTIONS
  305. #define MODUCOLLECTIONS_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_collections), MP_ROM_PTR(&mp_module_collections ) },
  306. #else
  307. #define MODUCOLLECTIONS_PORT_BUILTIN_MODULE_WEAK_LINKS
  308. #endif /* MICROPY_PY_COLLECTIONS */
  309. #ifdef MICROPYTHON_USING_UERRNO
  310. #define MODUERRNO_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno ) },
  311. #else
  312. #define MODUERRNO_PORT_BUILTIN_MODULE_WEAK_LINKS
  313. #endif /* MICROPY_PY_UERRNO */
  314. #ifdef MICROPYTHON_USING_UHASHLIB
  315. #define MODUHASHLIB_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_hashlib), MP_ROM_PTR(&mp_module_uhashlib ) },
  316. #else
  317. #define MODUHASHLIB_PORT_BUILTIN_MODULE_WEAK_LINKS
  318. #endif /* MICROPY_PY_UHASHLIB */
  319. #ifdef MICROPYTHON_USING_UHEAPQ
  320. #define MODUHEAPQ_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_heapq), MP_ROM_PTR(&mp_module_uheapq ) },
  321. #else
  322. #define MODUHEAPQ_PORT_BUILTIN_MODULE_WEAK_LINKS
  323. #endif /* MICROPY_PY_UHEAPQ */
  324. #if MICROPY_PY_IO
  325. #define MODUIO_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_io), MP_ROM_PTR(&mp_module_io ) },
  326. #else
  327. #define MODUIO_PORT_BUILTIN_MODULE_WEAK_LINKS
  328. #endif /* MICROPY_PY_UIO */
  329. #ifdef MICROPYTHON_USING_UJSON
  330. #define MODUJSON_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson ) },
  331. #else
  332. #define MODUJSON_PORT_BUILTIN_MODULE_WEAK_LINKS
  333. #endif /* MICROPY_PY_UJSON */
  334. #ifdef MICROPYTHON_USING_URANDOM
  335. #define MODURANDOM_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_random), MP_ROM_PTR(&mp_module_urandom ) },
  336. #else
  337. #define MODURANDOM_PORT_BUILTIN_MODULE_WEAK_LINKS
  338. #endif /* MICROPY_PY_URANDOM */
  339. #ifdef MICROPYTHON_USING_URE
  340. #define MODURE_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure ) },
  341. #else
  342. #define MODURE_PORT_BUILTIN_MODULE_WEAK_LINKS
  343. #endif /* MICROPY_PY_URE */
  344. #ifdef MICROPYTHON_USING_USELECT
  345. #define MODUSELECT_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_select), MP_ROM_PTR(&mp_module_uselect ) },
  346. #else
  347. #define MODUSELECT_PORT_BUILTIN_MODULE_WEAK_LINKS
  348. #endif /* MICROPY_PY_USELECT */
  349. #if MICROPY_PY_USSL
  350. #define MODUSSL_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_ssl), MP_ROM_PTR(&mp_module_ussl ) },
  351. #else
  352. #define MODUSSL_PORT_BUILTIN_MODULE_WEAK_LINKS
  353. #endif /* MICROPY_PY_USSL */
  354. #if MICROPY_PY_STRUCT
  355. #define MODUSTRUCT_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_struct), MP_ROM_PTR(&mp_module_ustruct ) },
  356. #else
  357. #define MODUSTRUCT_PORT_BUILTIN_MODULE_WEAK_LINKS
  358. #endif /* MICROPY_PY_USTRUCT */
  359. #ifdef MICROPY_PY_UTIME
  360. #define MODUTIME_PORT_BUILTIN_MODULES { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) },
  361. #define MODUTIME_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&mp_module_time ) },
  362. #else
  363. #define SOCKET_PORT_BUILTIN_MODULES
  364. #define MODUTIME_PORT_BUILTIN_MODULE_WEAK_LINKS
  365. #endif /* MICROPY_PY_UTIME */
  366. #ifdef MICROPYTHON_USING_UZLIB
  367. #define MODUZLIB_PORT_BUILTIN_MODULE_WEAK_LINKS { MP_ROM_QSTR(MP_QSTR_zlib), MP_ROM_PTR(&mp_module_uzlib ) },
  368. #else
  369. #define MODUZLIB_PORT_BUILTIN_MODULE_WEAK_LINKS
  370. #endif /* MICROPY_PY_UZLIB */
  371. // extra built in names to add to the global namespace
  372. #define MICROPY_PORT_BUILTINS \
  373. { MP_ROM_QSTR(MP_QSTR_exit), MP_ROM_PTR(&machine_soft_reset_obj) }, \
  374. { MP_ROM_QSTR(MP_QSTR_quit), MP_ROM_PTR(&machine_soft_reset_obj) }, \
  375. MODUOS_PORT_BUILTINS \
  376. #define MICROPY_PORT_BUILTIN_MODULES \
  377. { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \
  378. { MP_ROM_QSTR(MP_QSTR_pyb), MP_ROM_PTR(&pyb_module) }, \
  379. RTTHREAD_PORT_BUILTIN_MODULES \
  380. MODUOS_PORT_BUILTIN_MODULES \
  381. SOCKET_PORT_BUILTIN_MODULES \
  382. MODUTIME_PORT_BUILTIN_MODULES \
  383. #define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
  384. MODUTIME_PORT_BUILTIN_MODULE_WEAK_LINKS \
  385. MODUOS_PORT_BUILTIN_MODULE_WEAK_LINKS \
  386. SOCKET_PORT_BUILTIN_MODULE_WEAK_LINKS \
  387. MODUBINASCII_PORT_BUILTIN_MODULE_WEAK_LINKS \
  388. MODUCOLLECTIONS_PORT_BUILTIN_MODULE_WEAK_LINKS \
  389. MODUERRNO_PORT_BUILTIN_MODULE_WEAK_LINKS \
  390. MODUHASHLIB_PORT_BUILTIN_MODULE_WEAK_LINKS \
  391. MODUHEAPQ_PORT_BUILTIN_MODULE_WEAK_LINKS \
  392. MODUIO_PORT_BUILTIN_MODULE_WEAK_LINKS \
  393. MODUJSON_PORT_BUILTIN_MODULE_WEAK_LINKS \
  394. MODURANDOM_PORT_BUILTIN_MODULE_WEAK_LINKS \
  395. MODURE_PORT_BUILTIN_MODULE_WEAK_LINKS \
  396. MODUSELECT_PORT_BUILTIN_MODULE_WEAK_LINKS \
  397. MODUSSL_PORT_BUILTIN_MODULE_WEAK_LINKS \
  398. MODUSTRUCT_PORT_BUILTIN_MODULE_WEAK_LINKS \
  399. MODUTIME_PORT_BUILTIN_MODULE_WEAK_LINKS \
  400. MODUZLIB_PORT_BUILTIN_MODULE_WEAK_LINKS \
  401. MODUSTRUCT_PORT_BUILTIN_MODULE_WEAK_LINKS \
  402. #define MP_RTT_NOT_IMPL_PRINT rt_kprintf("Not implement on %s:%ld, Please add for your board!\n", __FILE__, __LINE__)