math functions

ajay.bhargav
Posts: 11
Joined: Fri Jul 17, 2015 7:13 pm

math functions

Postby ajay.bhargav » Sat Jul 18, 2015 5:23 am

Hi I need to use some math functions in my project but libm is not part of precompiled toolchain provided. So I compiled fresh toolchain from crosstool-NG available at github: https://github.com/jcmvbkbc/crosstool-NG I checked out branch lx106-g++. Toolchain compiled successfully. I can compile with libm now but... the linker reports error coz .text size has now increased > 0x8000

Code: Select all

/opt/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: .output/eagle/debug/image/eagle.app.v6.out section `.text' will not fit in region `iram1_0_seg'


I would like to know how can I use math functions? Are they available for ESP or not?

Her Mary
Posts: 476
Joined: Mon Oct 27, 2014 11:09 am

Re: math functions

Postby Her Mary » Mon Jul 20, 2015 5:27 pm


ajay.bhargav
Posts: 11
Joined: Fri Jul 17, 2015 7:13 pm

Re: math functions

Postby ajay.bhargav » Mon Jul 20, 2015 11:42 pm

Thanks, I already have libm.a I compiled toolchain myself, I even tried the one you shared. But the problem is iram0 section getting overflowed > 0x8000 Which is the limit of ESP8266. I think simply compiling libm with application does not solve the problem. So I change the question... Is it possible to link libm.a symbols to irom0 section whereas rest of the section as it is.

I tried changing linker but nothing worked. I moved irom0.text to before .text section and added following:

Code: Select all

 .irom0.text : ALIGN(4)
  {
    _irom0_text_start = ABSOLUTE(.);
    *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
    *(libm.a)
    *(libc.a)
    *(libgcc.a)
    _irom0_text_end = ABSOLUTE(.);
  } >irom0_0_seg :irom0_0_phdr

This does work and move all the symbols from .text to irom0 but application does not work at all.

I then tried:

Code: Select all

 .irom0.text : ALIGN(4)
  {
    _irom0_text_start = ABSOLUTE(.);
    *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
    libm.a: *(.literal .text)
    _irom0_text_end = ABSOLUTE(.);
  } >irom0_0_seg :irom0_0_phdr


this did not work either.. so any suggestion to move libm to rom section??? anyone from Espressif team?

Regards,
Ajay

User avatar
Nikolay
Posts: 6
Joined: Thu Aug 13, 2015 12:39 am

Re: math functions

Postby Nikolay » Thu Jul 13, 2017 8:12 pm

That should be:
.irom0.text : ALIGN(4)
{
_irom0_text_start = ABSOLUTE(.);

*libm.a:(.literal .text .literal.* .text.*)
....

works for me.

User avatar
neilwalker
Posts: 10
Joined: Wed Dec 20, 2017 7:17 pm

Re: math functions

Postby neilwalker » Thu Sep 24, 2020 7:45 pm

Nikolay wrote:

I'm using Crosstool-NG for my projects too. The last release was in Apr 13, 2019, but it's still a good toolchain generator. I'm a student at Tsinghua University and it helps me write my essays online lab reports and assignments.



Hello,
What are some modern alternatives of a Crosstool-NG toolchain generator? I'm facing an error: "GAS does not know what format to use for target arm-linux-gnueabihf" when trying to build cross-compiler with the git version of crosstool-ng. Thanks.

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Majestic-12 [Bot] and 7 guests