Skip to content

Conversation

@kammce
Copy link
Member

@kammce kammce commented Dec 31, 2024

No description provided.

kammce added 20 commits April 14, 2025 09:32
There is one thing that is broken. If you guess the entry number for
the function address for the function that starts the short table,
you will get the guess from the normal table. This seems like a clear
off by one error somewhere.
Test using `multi_levels.cpp` symbol CSV:

```bash
python3 nearpoint.py multi.csv -b 12 -s 7
```

Test using `firefox.cpp` sorted symbols CSV:

```bash
python3 nearpoint.py multi.csv -b 12
```
The nm command is:

```
arm-none-eabi-nm app.elf --size-sort --radix=d | grep " [Tt] " | awk '{print $1}' > funct.nm
```
Also -ffunction-sections is REQUIRED to relocate the functions.
My build process is kind of this:

- From the root of the repo, build demos:

```
conan build demos -pr stm32f103c8 -pr arm-gcc-12.3 \
-o "*:runtime=estell" -s build_type=Release
```

- Generate linker script function ordering:

```
python3 demos/edx_extract.py \
demos/build/stm32f103c8/MinSizeRel/multi_levels.elf
```

- Move `multi_levels.elf.nm` to `demos/`
- Move `multi_levels.elf.part.ld` to `demos/`
- Generate near point tables:

```
python3 scripts/nearpoint.py demos/multi_levels.elf.nm -n -b 10
```

- Build again to pull in the new ordering and near point table.

- Dump the list of functions in order using `nm`
```
arm-none-eabi-nm --print-size -n \
demos/build/stm32f103c8/MinSizeRel/multi_levels.elf | \
grep " [TtWw] " > demos/multi_levels.elf.func
```

- Compare function order of `demos/multi_levels.elf.func` with
  `multi_levels.elf.part.ld`
@kammce
Copy link
Member Author

kammce commented Jul 10, 2025

Closing this for now. Will bring back nearpoint on a later version of this repo.

@kammce kammce closed this Jul 10, 2025
@kammce kammce deleted the near-point branch August 29, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants