Skip to content
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

Coremark: a wrong library archive used by linker.lf? (IEC-158) #368

Closed
2 tasks done
suda-morris opened this issue Aug 29, 2024 · 0 comments · Fixed by #383
Closed
2 tasks done

Coremark: a wrong library archive used by linker.lf? (IEC-158) #368

suda-morris opened this issue Aug 29, 2024 · 0 comments · Fixed by #383

Comments

@suda-morris
Copy link
Collaborator

suda-morris commented Aug 29, 2024

Answers checklist.

  • I have read the documentation of the component in question and the issue is not addressed there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

As a managed component, coremark component will be compiled into a static library: libespressif__coremark.a.

While in the linker.lf file, we're still using libcoremark.a as the archive name.

objdump of the example ELF file,

42006fc4 <core_bench_matrix>:
{
42006fc4:	004136        	entry	a1, 32
    crc = crc16(matrix_test(N, C, A, B, val), crc);
42006fc7:	0222d2        	l32i	a13, a2, 8
42006fca:	0122c2        	l32i	a12, a2, 4
42006fcd:	32b8      	l32i.n	a11, a2, 12
42006fcf:	0022a2        	l32i	a10, a2, 0
42006fd2:	23e380        	sext	a14, a3, 15
42006fd5:	ffc8e5        	call8	42006c64 <matrix_test>

The function is still linked to the Flash cache address space.

After change to archive: libespressif__coremark.a, we can finally see its in the IRAM now.

4037a244 <core_bench_matrix>:
{
4037a244:	004136        	entry	a1, 32
    crc = crc16(matrix_test(N, C, A, B, val), crc);
4037a247:	0222d2        	l32i	a13, a2, 8
4037a24a:	0122c2        	l32i	a12, a2, 4
4037a24d:	32b8      	l32i.n	a11, a2, 12
4037a24f:	0022a2        	l32i	a10, a2, 0
4037a252:	23e380        	sext	a14, a3, 15
4037a255:	ffc8e5        	call8	40379ee4 <matrix_test>

I wish I could see the link errors when I export LDGEN_CHECK_MAPPING=1, but no, the build still success. Seems to me like it's a bug in the ldgen.

If we change the linker.lf into this

[mapping:coremark]
archive: libcoremark.a
entries:
    core_matrix (noflash)

We will see the errors as expected:

linker script generation failed for /home/morris/esp/coremark_example/build/esp-idf/esp_system/ld/sections.ld.in
ERROR: 'libcoremark.a:core_matrix None' not found
In fragment 'coremark' defined in '/home/morris/esp/coremark_example/managed_components/espressif__coremark/linker.lf'.
@github-actions github-actions bot changed the title Coremark: a wrong library archive used by linker.lf? Coremark: a wrong library archive used by linker.lf? (IEC-158) Aug 29, 2024
@igrr igrr closed this as completed in #383 Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants