Update memory map script and cleanup
This commit is contained in:
@@ -24,7 +24,6 @@ int pool_bm_get_free_idx(PoolBitmap *bm);
|
|||||||
} type##Pool; \
|
} type##Pool; \
|
||||||
type *pool_get_##type(); \
|
type *pool_get_##type(); \
|
||||||
void pool_free_##type(type *obj); \
|
void pool_free_##type(type *obj); \
|
||||||
void pool_init_##type(type##Pool *pool);
|
|
||||||
|
|
||||||
#define POOL_DEFINE_TYPE(type, capacity) \
|
#define POOL_DEFINE_TYPE(type, capacity) \
|
||||||
static type type##_storage[capacity]; \
|
static type type##_storage[capacity]; \
|
||||||
|
|||||||
+30
-17
@@ -1,10 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Run this from the root directory of the project, not the scripts directory
|
|
||||||
POOL_DEF_FILE='./include/pools.def'
|
POOL_DEF_FILE='./include/pools.def'
|
||||||
ELF_FILE='./build/balatro.elf'
|
ELF_FILE='./build/balatro-gba.elf'
|
||||||
READELF='/opt/devkitpro/devkitARM/bin/arm-none-eabi-readelf'
|
READELF='/opt/devkitpro/devkitARM/bin/arm-none-eabi-readelf'
|
||||||
|
|
||||||
get_pool_names() {
|
get_pool_names() {
|
||||||
@@ -13,24 +10,40 @@ get_pool_names() {
|
|||||||
|
|
||||||
TOTAL_BYTES=0
|
TOTAL_BYTES=0
|
||||||
|
|
||||||
echo "--------------------------------------------"
|
print_line_break() {
|
||||||
printf "%-16s| %-10s | %s\n" "Object" "location" "size"
|
echo "--------------------------------------------------------------------"
|
||||||
echo "--------------------------------------------"
|
}
|
||||||
|
|
||||||
|
print_line_break
|
||||||
|
printf "%-16s| %-10s | %-10s | %-10s | %-10s \n" "Object" "location" "pool size" "func size" "bitmap size"
|
||||||
|
print_line_break
|
||||||
|
|
||||||
for name in $(get_pool_names); do
|
for name in $(get_pool_names); do
|
||||||
output="$( \
|
output_pool="$( \
|
||||||
"$READELF" -sW "$ELF_FILE" | \
|
"$READELF" -sW "$ELF_FILE" | \
|
||||||
grep "${name}_" | \
|
grep "${name}_" | \
|
||||||
grep OBJECT | \
|
grep OBJECT | \
|
||||||
grep storage | sed -E 's@ +@ @g; s@^ @@' \
|
grep storage | \
|
||||||
|
sed -E 's@ +@ @g; s@^ @@' \
|
||||||
|
)"
|
||||||
|
output_func="$( \
|
||||||
|
"$READELF" -sW "$ELF_FILE" | \
|
||||||
|
grep -E "pool_free|pool_get|pool_init" | \
|
||||||
|
grep -E "${name}$" | \
|
||||||
|
sed -E 's@ +@ @g; s@^ @@' | \
|
||||||
|
tr -d '\n' \
|
||||||
)"
|
)"
|
||||||
|
|
||||||
location="$(cut -d ' ' -f 2 <<< $output)"
|
|
||||||
size="$(cut -d ' ' -f 3 <<< $output)"
|
|
||||||
TOTAL_BYTES=$(( TOTAL_BYTES + size ))
|
|
||||||
|
|
||||||
printf "%-16s| 0x%s | %-8u\n" "$name" "$location" "$size"
|
location="$(cut -d ' ' -f 2 <<< $output_pool)"
|
||||||
|
pool_size="$(cut -d ' ' -f 3 <<< $output_pool)"
|
||||||
|
func_size="$(cut -d ' ' -f 3 <<< $output_func)"
|
||||||
|
bm_size=4 #always gonna be 4, sizof(u32)
|
||||||
|
|
||||||
|
TOTAL_BYTES=$(( TOTAL_BYTES + pool_size + func_size + bm_size ))
|
||||||
|
|
||||||
|
printf "%-16s| 0x%8s | %-10u | %-10u | %-10u \n" "$name" "$location" "$pool_size" "$func_size" "$bm_size"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "--------------------------------------------"
|
print_line_break
|
||||||
echo Total bytes used: $TOTAL_BYTES
|
echo Total bytes used: $TOTAL_BYTES
|
||||||
|
|||||||
Reference in New Issue
Block a user