Skip to content

Near point #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed

Near point #59

wants to merge 20 commits into from

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
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.

1 participant