Added size optimize flag

This commit is contained in:
jakeg00dwin 2024-06-14 15:08:29 -07:00
parent abaaaaaa0d
commit 74384000d8
3 changed files with 17 additions and 8 deletions

View File

@ -33,7 +33,7 @@ set(CMAKE_SIZE avr-size)
#set(CMAKE_C_FLAGS_INIT "-mmcu=${AVR_MCU} -DF_CPU=16000000UL")
#set(CMAKE_CXX_FLAGS_INIT "-mmcu=${AVR_MCU} -DF_CPU=16000000UL")
#set(CMAKE_EXE_LINKER_FLAGS_INIT "-mmcu=${AVR_MCU}")
set(CMAKE_C_FLAGS "-mmcu=${AVR_MCU} -DF_CPU=16000000UL")
set(CMAKE_C_FLAGS " -Os -mmcu=${AVR_MCU} -DF_CPU=16000000UL")
set(CMAKE_CXX_FLAGS "-mmcu=${AVR_MCU} -DF_CPU=16000000UL")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-mmcu=${AVR_MCU}")

22
otto.sh
View File

@ -3,7 +3,7 @@
# Date: 2024
# Filename: otto.sh
CROSS_TC_WIN="$(pwd)/i686-w64-mingw32_toolchain.cmake"
AVR_TC="$(pwd)/avr-gcc-toolchain.cmake"
CMAKE_VERBOSE="ON"
CROSS_COMPILE=1
TEMPLATE_FILES=".template_files"
@ -171,6 +171,16 @@ build_main () {
make main
}
build_hex () {
clear_cmake_cache
CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE}"
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${AVR_TC}"
cmake ${CMAKE_ARGS} ../
make hex
}
run_c_tests () {
clear_cmake_cache
cmake -DUNIT_TESTING=ON -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE} ../
@ -180,9 +190,9 @@ run_c_tests () {
print_menu () {
echo "BUILD MENU:"
echo "1. Run Tests"
echo "2. Build Project"
echo "3. Build for release"
echo "4. cross compile for XXXXXX"
echo "2. Build Project(hex)"
echo "3. Build for release(hex)"
echo "4. Flash to AVR"
echo "5. Add new module to project"
echo "6. Delete module from project"
echo "7. Exit"
@ -206,12 +216,12 @@ main() {
2)
echo "You selected Option 2"
valid_choice=true
build_main
build_hex
;;
3)
echo "You selected Option 3"
valid_choice=true
build_release
build_hex
;;
4)
echo "You selected Option 4"

View File

@ -22,7 +22,6 @@ add_custom_target(hex ALL
)
endif()
if(NOT TARGET bin)
# Define how to convert ELF to BIN
add_custom_target(bin ALL