Recent

Author Topic: Xtensa-freertos wiki  (Read 9852 times)

ccrause

  • Hero Member
  • *****
  • Posts: 970
Xtensa-freertos wiki
« on: January 04, 2022, 01:06:02 pm »
The wiki instructions for xtensa-freertos has been updated.  Please review and update if anything is unclear, misleading or wrong.

Note that the information is Linux focused, please update/add information as required for other OSs.

Alternatively discuss issues with the information on the wiki page in this thread so that the usability of the page can be improved.

botster

  • New Member
  • *
  • Posts: 39
Re: Xtensa-freertos wiki
« Reply #1 on: January 04, 2022, 08:09:53 pm »
It is much more clear now. Thank you very much.

I did notice that you included an example 'hello world' program in the ESP8266 section, but not in the ESP32 section. And, the example fpc directory path (eg. ~/fpc/main) was just "~/fpc" in the ESP8266 section.

I corrected the example path in the ESP8266 section and included the example "hello world" program in the ESP32 section.

Now, one more question. When it says, "Create a hello world program [...] in the fpc dir", I am assuming that is for simplicity, and one could put the program in a directory of their choice providing the paths in the compiler command line are adjusted appropriately. Correct? I ask because, personally, I would not want to clutter up my fpc source directory.
Lee

botster

  • New Member
  • *
  • Posts: 39
Re: Xtensa-freertos wiki
« Reply #2 on: January 05, 2022, 12:43:00 am »
I believe there is an error in the test program compiler command for the ESP8266 Compile and run test program. The last option is:
Code: Pascal  [Select][+][-]
  1. -Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/lib/
However, there is no 'sysroot' directory in ~/esp/xtensa-lx106-elf/xtensa-lx106-elf

Changing the option to:
Code: Pascal  [Select][+][-]
  1. -Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/lib/
allowed the linker to find libstdc++.a
Lee

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: Xtensa-freertos wiki
« Reply #3 on: January 05, 2022, 08:25:15 am »
It is much more clear now. Thank you very much.

I did notice that you included an example 'hello world' program in the ESP8266 section, but not in the ESP32 section. And, the example fpc directory path (eg. ~/fpc/main) was just "~/fpc" in the ESP8266 section.

I corrected the example path in the ESP8266 section and included the example "hello world" program in the ESP32 section.

Thanks for updating this.

Quote
Now, one more question. When it says, "Create a hello world program [...] in the fpc dir", I am assuming that is for simplicity, and one could put the program in a directory of their choice providing the paths in the compiler command line are adjusted appropriately. Correct? I ask because, personally, I would not want to clutter up my fpc source directory.
Yes, you are correct, updated.

af0815

  • Hero Member
  • *****
  • Posts: 1379
Re: Xtensa-freertos wiki
« Reply #4 on: January 05, 2022, 10:23:17 am »
Can the chapter 1.3.1 up to 1.3.4 declared a linux area. Because the commandlines are Linux only IMHO. Actual there is no working version for windows as far as i know.
regards
Andreas

botster

  • New Member
  • *
  • Posts: 39
Re: Xtensa-freertos wiki
« Reply #5 on: January 05, 2022, 06:43:44 pm »
Quote
Now, one more question. When it says, "Create a hello world program [...] in the fpc dir", I am assuming that is for simplicity, and one could put the program in a directory of their choice providing the paths in the compiler command line are adjusted appropriately. Correct? I ask because, personally, I would not want to clutter up my fpc source directory.
Yes, you are correct, updated.

I don't want to second-guess you in case I am incorrect. But, shouldn't
Code: Pascal  [Select][+][-]
  1. ~/fpc/main/compiler/ppcrossxtensa -Furtl/units/xtensa-freertos/ -Tfreertos -XPxtensa-lx106-elf- -O3 -Wpesp8266 hello -Fl~/esp/xtensa-lx106-elf-libs/ -Fl$IDF_PATH/components/esp8266/lib -Fl$IDF_PATH/components/newlib/newlib/lib -Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/lib/
be
Code: Pascal  [Select][+][-]
  1. ~/fpc/main/compiler/ppcrossxtensa -Fu~/fpc/main/rtl/units/xtensa-freertos/ -Tfreertos -XPxtensa-lx106-elf- -O3 -Wpesp8266 hello -Fl~/esp/xtensa-lx106-elf-libs/ -Fl$IDF_PATH/components/esp8266/lib -Fl$IDF_PATH/components/newlib/newlib/lib -Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/lib/
(ie. "-Fu~/fpc/main/rtl/units/xtensa-freertos/")?
Lee

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: Xtensa-freertos wiki
« Reply #6 on: January 05, 2022, 06:51:47 pm »
I don't want to second-guess you in case I am incorrect. But, shouldn't
Code: Pascal  [Select][+][-]
  1. ~/fpc/main/compiler/ppcrossxtensa -Furtl/units/xtensa-freertos/ -Tfreertos -XPxtensa-lx106-elf- -O3 -Wpesp8266 hello -Fl~/esp/xtensa-lx106-elf-libs/ -Fl$IDF_PATH/components/esp8266/lib -Fl$IDF_PATH/components/newlib/newlib/lib -Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/lib/
be
Code: Pascal  [Select][+][-]
  1. ~/fpc/main/compiler/ppcrossxtensa -Fu~/fpc/main/rtl/units/xtensa-freertos/ -Tfreertos -XPxtensa-lx106-elf- -O3 -Wpesp8266 hello -Fl~/esp/xtensa-lx106-elf-libs/ -Fl$IDF_PATH/components/esp8266/lib -Fl$IDF_PATH/components/newlib/newlib/lib -Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/lib/
(ie. "-Fu~/fpc/main/rtl/units/xtensa-freertos/")?

You are correct, please feel free to edit the wiki.  Thanks for checking the content.

botster

  • New Member
  • *
  • Posts: 39
Re: Xtensa-freertos wiki
« Reply #7 on: January 06, 2022, 01:33:53 am »
@ccrause, you're correct. As you mentioned in another thread, there is a note about using -WP to specify the SDK version number. I did not see it before; probably from reading too fast.

May I suggest the individual notes be put near the paragraph to which they pertain? For example, the note about -WP would go directly underneath the compiler command.

Or, do you think this would make things look more cluttered?
Lee

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: Xtensa-freertos wiki
« Reply #8 on: January 06, 2022, 06:15:07 am »
@ccrause, you're correct. As you mentioned in another thread, there is a note about using -WP to specify the SDK version number. I did not see it before; probably from reading too fast.

May I suggest the individual notes be put near the paragraph to which they pertain? For example, the note about -WP would go directly underneath the compiler command.

Or, do you think this would make things look more cluttered?

The presentation format is not ideal at the moment.  I would prefer not to repeat common information, but the page is quite busy so it is easy to miss details like using the -WP option.  I tend to agree that one should probably treat each paragraph (or at least subsection) as standalone, so all information should be presented where applicable.

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: Xtensa-freertos wiki
« Reply #9 on: March 17, 2024, 06:24:21 pm »
Cool, it's great to see more languages supporting this architecture. FPC supports it without using LLVM (espressif-fork).
The wiki doesn't specify if esp32-s2 and esp32-s3 are also supported.
Not yet, but in principle this should not be too challenging.
Quote
Does anyone have experience with idf v5.x?
I have tried a few times to link an fpc example against esp-idf 5.0 & 5.2, but I've run into a problem where xtensa-esp32-elf-ld reported it cannot locate the precompiled esp-idf libraries, even though the path information was correct.

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: Xtensa-freertos wiki
« Reply #10 on: March 18, 2024, 10:47:34 am »
Does anyone have experience with idf v5.x?
I have tried a few times to link an fpc example against esp-idf 5.0 & 5.2, but I've run into a problem where xtensa-esp32-elf-ld reported it cannot locate the precompiled esp-idf libraries, even though the path information was correct.
I checked again and have successfully linked a simple project against esp-idf 5.2 (using bintools xtensa-esp32-elf-gcc11_2_0-esp-2022r1).  Unfortunately there is a deadlock on startup of the generated binary, so some further tweaks are required.

znagy

  • Newbie
  • Posts: 2
Re: Xtensa-freertos wiki
« Reply #11 on: October 04, 2024, 08:27:37 pm »
Hi, may I ask you, does the compiler support placing variables into external RAM, like the EXT_MEM_ATTR in C for ESP32? Thx.

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: Xtensa-freertos wiki
« Reply #12 on: October 04, 2024, 10:34:23 pm »
Hi, may I ask you, does the compiler support placing variables into external RAM, like the EXT_MEM_ATTR in C for ESP32? Thx.

In principle it should be possible, but then esp-idf must be configured with the Support for external, SPI-connected RAM option via menuconfig and rebuild as described in the wiki.  Then you can tell FPC to place variables there using the section directive:
Code: Pascal  [Select][+][-]
  1. var
  2.  i: integer; section '.ext_ram.bss';
Note that it is necessary to copy the new esp32_out.ld and esp32.project.ld linker scripts (renamed to memory.ld and sections.ld since esp-idf v4.4) into the libraries folder, since these get updated with the PSRAM settings.

ccrause

  • Hero Member
  • *****
  • Posts: 970
Re: Xtensa-freertos wiki
« Reply #13 on: October 05, 2024, 09:48:49 am »
Hi, may I ask you, does the compiler support placing variables into external RAM, like the EXT_MEM_ATTR in C for ESP32? Thx.

In principle it should be possible, but then esp-idf must be configured with the Support for external, SPI-connected RAM option via menuconfig and rebuild as described in the wiki.  Then you can tell FPC to place variables there using the section directive:
Code: Pascal  [Select][+][-]
  1. var
  2.  i: integer; section '.ext_ram.bss';
Note that it is necessary to copy the new esp32_out.ld and esp32.project.ld linker scripts (renamed to memory.ld and sections.ld since esp-idf v4.4) into the libraries folder, since these get updated with the PSRAM settings.

PS: You probably (untested) also need to link (-Fl) against the PSRAM aware system libraries (libc, libgcc etc.) located in the tools folder (if following the wiki instructions).  On my PC the relevant folders are located here:
~/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/esp32/psram/no-rtti
and
~/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/lib/esp32/psram/no-rtti

The binutils version in the paths above will depend on the esp-idf version you installed.

znagy

  • Newbie
  • Posts: 2
Re: Xtensa-freertos wiki
« Reply #14 on: October 07, 2024, 04:54:45 pm »
Thank you very much, it works perfectly! When declaring the variable in a unit, section '.ext_ram_noinit' can be used.
« Last Edit: October 07, 2024, 05:58:21 pm by znagy »

 

TinyPortal © 2005-2018