Compare commits
3 commits
a7682c802a
...
be9832c403
Author | SHA1 | Date | |
---|---|---|---|
|
be9832c403 | ||
|
658530818e | ||
|
a33c9e1957 |
3 changed files with 9 additions and 10 deletions
|
@ -60,8 +60,6 @@ instructions.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- [ ] Add NewLib finding/functionality
|
|
||||||
- [ ] Add NewLib-nano finding/functionality
|
|
||||||
- [X] Add ch32v003fun sources.
|
- [X] Add ch32v003fun sources.
|
||||||
- [X] Add example blinky default main.
|
- [X] Add example blinky default main.
|
||||||
- [ ] Add useful test examples.
|
- [ ] Add useful test examples.
|
||||||
|
|
3
otto.sh
3
otto.sh
|
@ -8,6 +8,7 @@ CMAKE_VERBOSE="ON"
|
||||||
CROSS_COMPILE=1
|
CROSS_COMPILE=1
|
||||||
TEMPLATE_FILES=".template_files"
|
TEMPLATE_FILES=".template_files"
|
||||||
MODULE_DIR="${TEMPLATE_FILES}/modules"
|
MODULE_DIR="${TEMPLATE_FILES}/modules"
|
||||||
|
CHIP="ch32v003"
|
||||||
|
|
||||||
|
|
||||||
format_source_code () {
|
format_source_code () {
|
||||||
|
@ -265,7 +266,7 @@ build_hex_optimized () {
|
||||||
|
|
||||||
flash_microcontroller () {
|
flash_microcontroller () {
|
||||||
build_hex_optimized
|
build_hex_optimized
|
||||||
make upload
|
wlink --chip=${CHIP} flash ./src/main.elf
|
||||||
}
|
}
|
||||||
|
|
||||||
run_c_tests () {
|
run_c_tests () {
|
||||||
|
|
|
@ -8,9 +8,14 @@ target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
${CMAKE_SOURCE_DIR}
|
${CMAKE_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
gcc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# The `-ffunction-sections` and `-fdata-sections` need to be used
|
||||||
|
# in the compile and linker options otherwise it doesnt't
|
||||||
|
# correctly remove the unused functions.
|
||||||
target_compile_options(${PROJECT_NAME} PUBLIC
|
target_compile_options(${PROJECT_NAME} PUBLIC
|
||||||
-g
|
-g
|
||||||
-Os
|
-Os
|
||||||
|
@ -22,14 +27,9 @@ target_compile_options(${PROJECT_NAME} PUBLIC
|
||||||
-march=rv32ec
|
-march=rv32ec
|
||||||
-mabi=ilp32e
|
-mabi=ilp32e
|
||||||
-DCH32V003=1
|
-DCH32V003=1
|
||||||
-static-libgcc
|
|
||||||
-nostdlib
|
|
||||||
-lgcc
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_options(${PROJECT_NAME} PUBLIC
|
target_link_options(${PROJECT_NAME} PUBLIC
|
||||||
-g
|
|
||||||
-Os
|
|
||||||
-flto
|
-flto
|
||||||
-ffunction-sections
|
-ffunction-sections
|
||||||
-fdata-sections
|
-fdata-sections
|
||||||
|
@ -37,9 +37,9 @@ target_link_options(${PROJECT_NAME} PUBLIC
|
||||||
-msmall-data-limit=8
|
-msmall-data-limit=8
|
||||||
-march=rv32ec
|
-march=rv32ec
|
||||||
-mabi=ilp32e
|
-mabi=ilp32e
|
||||||
-DCH32V003=1
|
|
||||||
-static-libgcc
|
-static-libgcc
|
||||||
-nostdlib
|
-nostdlib
|
||||||
|
-L${CMAKE_SOURCE_DIR}/src
|
||||||
-Wl,--print-memory-usage
|
-Wl,--print-memory-usage
|
||||||
-Wl,-Map=${PROJECT_NAME}.map
|
-Wl,-Map=${PROJECT_NAME}.map
|
||||||
-Wl,--gc-sections
|
-Wl,--gc-sections
|
||||||
|
|
Loading…
Add table
Reference in a new issue