rtconfig.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import os
  2. # toolchains options
  3. ARCH ='risc-v'
  4. CPU =''
  5. CROSS_TOOL ='gcc'
  6. if os.getenv('RTT_CC'):
  7. CROSS_TOOL = os.getenv('RTT_CC')
  8. if CROSS_TOOL == 'gcc':
  9. PLATFORM = 'gcc'
  10. EXEC_PATH = r'~/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin'
  11. else:
  12. print('Please make sure your toolchains is GNU GCC!')
  13. exit(0)
  14. if os.getenv('RTT_EXEC_PATH'):
  15. EXEC_PATH = os.getenv('RTT_EXEC_PATH')
  16. EXEC_PATH = os.path.expanduser(EXEC_PATH)
  17. BUILD = 'debug'
  18. if PLATFORM == 'gcc':
  19. # toolchains
  20. PREFIX = 'riscv32-esp-elf-'
  21. CC = PREFIX + 'gcc'
  22. CXX = PREFIX + 'g++'
  23. AS = PREFIX + 'gcc'
  24. AR = PREFIX + 'ar'
  25. LINK = PREFIX + 'g++'
  26. TARGET_EXT = 'elf'
  27. SIZE = PREFIX + 'size'
  28. OBJDUMP = PREFIX + 'objdump'
  29. OBJCPY = PREFIX + 'objcopy'
  30. STRIP = PREFIX + 'strip'
  31. DEVICE = ' -nostartfiles -march=rv32imc --specs=nosys.specs -fasynchronous-unwind-tables '
  32. CFLAGS = DEVICE + '-include ../../components/libc/compilers/common/include/sys/ioctl.h -gdwarf-4 -ggdb -Og '
  33. AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
  34. LFLAGS = DEVICE + ' -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0 -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,_start -T idf_port/ld/memory.ld -T idf_port/ld/sections.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.version.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld -T packages/ESP-IDF-latest/components/soc/esp32c3/ld/esp32c3.peripherals.ld -Wl,--wrap=_Unwind_SetEnableExceptionFdeSorting -Wl,--wrap=__register_frame_info_bases -Wl,--wrap=__register_frame_info -Wl,--wrap=__register_frame -Wl,--wrap=__register_frame_info_table_bases -Wl,--wrap=__register_frame_info_table -Wl,--wrap=__register_frame_table -Wl,--wrap=__deregister_frame_info_bases -Wl,--wrap=__deregister_frame_info -Wl,--wrap=_Unwind_Find_FDE -Wl,--wrap=_Unwind_GetGR -Wl,--wrap=_Unwind_GetCFA -Wl,--wrap=_Unwind_GetIP -Wl,--wrap=_Unwind_GetIPInfo -Wl,--wrap=_Unwind_GetRegionStart -Wl,--wrap=_Unwind_GetDataRelBase -Wl,--wrap=_Unwind_GetTextRelBase -Wl,--wrap=_Unwind_SetIP -Wl,--wrap=_Unwind_SetGR -Wl,--wrap=_Unwind_GetLanguageSpecificData -Wl,--wrap=_Unwind_FindEnclosingFunction -Wl,--wrap=_Unwind_Resume -Wl,--wrap=_Unwind_RaiseException -Wl,--wrap=_Unwind_DeleteException -Wl,--wrap=_Unwind_ForcedUnwind -Wl,--wrap=_Unwind_Resume_or_Rethrow -Wl,--wrap=_Unwind_Backtrace -Wl,--wrap=__cxa_call_unexpected -Wl,--eh-frame-hdr -Wl,--wrap=__gxx_personality_v0 -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0'
  35. CXXFLAGS = CFLAGS
  36. POST_ACTION = OBJCPY + ' -Oihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n'