Skip to content

Commit

Permalink
Optimize cache and memory access
Browse files Browse the repository at this point in the history
Some optimized tricks for AVR are included in this commit.
I spent a lot of time optimizing every line in these functions, looking for instruction-level optimization using godbolt.
A large portion of the time was spent on GDB, since I forgot bunch of checks and variable changes when I optimize these function.
Don't be stupid like me
  • Loading branch information
raspiduino committed Jul 3, 2024
1 parent eb13613 commit 956f8a8
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 510 deletions.
16 changes: 14 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ sim_opt() {
gcc -I. -march=native -Ofast -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -std=gnu99 main_sim.c if_sim.c -o sim
}

clean() {
# sim
rm sim dump.bin

# avr
rm *.o *.lst *.map *.elf
}

# Check for help flag
if [[ "$1" == "-h" || "$1" == "--help" || "$1" == "help" ]]; then
echo "Usage: $0 (sim|sim_opt|avr)"
Expand All @@ -42,8 +50,12 @@ else
if [[ "$1" == "avr" ]]; then
avr
else
echo "Invalid argument: '$1'"
exit 1
if [[ "$1" == "clean" ]]; then
clean
else
echo "Invalid argument: '$1'"
exit 1
fi
fi
fi
fi
Loading

0 comments on commit 956f8a8

Please sign in to comment.