Date   

Re: Problem with LPTIM on Zephyr

Erwan Gouriou
 

Hi Raz,


Did you checked that the clocks are correctly enabled?
In any case, I'd suggest to minimize the use of Cube functions to the timer related functions.
Zephyr provides most of things you need for MSP and board init.

Cheers
Erwan

On Fri, 12 Feb 2021 at 14:59, Raz <raziebe@...> wrote:
hello.
I am trying to use the LPTIM for the nucleos 476  by integrating it from CUBE. I ported the code below to Zephyr:

 HAL_Init();

  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_LPTIM1_Init();
  for (;i<2;i++) {
 HAL_GPIO_TogglePin (GPIOA, GPIO_PIN_5);
 HAL_Delay(1000);
  }
  /*
   * LSE Input freq is 32768 hz.
   *  32768/64 = 512hz
   * */
  int secs = 3;
  if (HAL_LPTIM_Counter_Start_IT(&hlptim1, 512* secs + 1) != HAL_OK) {
     Error_Handler();
  }
  HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
  while (1)
  {
 HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
  }
  /* USER C

However, the timer does not start. Anyone is familiar with this problem ?

Kind regards


Re: STM32L Errors Building samples/drivers/spi_fujitsu_fram with Ninja

Erwan Gouriou
 

Hi Ron,

First question: do you have the matching FRAM that is described on  the sample ?

If  yes, I'd suggest adding "spi_1 = &spi1;" in your board aliases, and hopefully this should work.

BR

Erwan


On Mon, 15 Feb 2021 at 18:39, <ron@...> wrote:
New to Zephyr, no problem with building and running the hello world example for an STM32L433, nucleo_l433rc_p board
Trying to build samples/drivers/spi_fujitsu_fram as an example of SPI use. From a created build directly cmake -GNinja -DBOARD=nucleo_l433rc_p .. runs through ok, but Ninja fails with:

/media/fred/zephyrdev/stm-testbed/zephyr/include/devicetree.h:208:32: error: 'DT_N_ALIAS_spi_1_P_label' undeclared (first use in this function)
  208 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
      |                                ^~~~~~~~~~~
/media/fred/zephyrdev/stm-testbed/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
 2176 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
/media/fred/zephyrdev/stm-testbed/zephyr/include/devicetree.h:584:27: note: in expansion of macro 'DT_PROP'
  584 | #define DT_LABEL(node_id) DT_PROP(node_id, label)
      |                           ^~~~~~~
../src/main.c:148:27: note: in expansion of macro 'DT_LABEL'
  148 |  spi = device_get_binding(DT_LABEL(DT_ALIAS(spi_1)));
      |                           ^~~~~~~~

and other similar errors.
Have checked that SPI1 is enabled for the board in the .dts file.  Also tried building for other STM32 boards but getting similar errors running Ninja.
Some guidance would be appreciated.


STM32L Errors Building samples/drivers/spi_fujitsu_fram with Ninja

@kiwironnie
 

New to Zephyr, no problem with building and running the hello world example for an STM32L433, nucleo_l433rc_p board
Trying to build samples/drivers/spi_fujitsu_fram as an example of SPI use. From a created build directly cmake -GNinja -DBOARD=nucleo_l433rc_p .. runs through ok, but Ninja fails with:

/media/fred/zephyrdev/stm-testbed/zephyr/include/devicetree.h:208:32: error: 'DT_N_ALIAS_spi_1_P_label' undeclared (first use in this function)
  208 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
      |                                ^~~~~~~~~~~
/media/fred/zephyrdev/stm-testbed/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
 2176 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
/media/fred/zephyrdev/stm-testbed/zephyr/include/devicetree.h:584:27: note: in expansion of macro 'DT_PROP'
  584 | #define DT_LABEL(node_id) DT_PROP(node_id, label)
      |                           ^~~~~~~
../src/main.c:148:27: note: in expansion of macro 'DT_LABEL'
  148 |  spi = device_get_binding(DT_LABEL(DT_ALIAS(spi_1)));
      |                           ^~~~~~~~

and other similar errors.
Have checked that SPI1 is enabled for the board in the .dts file.  Also tried building for other STM32 boards but getting similar errors running Ninja.
Some guidance would be appreciated.


Adafruit Feather Sense on Zephyr

Dimitrios Kosyvas <kosyvas14828@...>
 

Hello
I want to use Zephyr to build an audio recognition application  for my thesis and then flash it via a external debugger to Adafruit Feather Sense .In the list of supported boards there is
Adafruit Feather nrf52840 Express and i was wondering  if i can use  that to build for the Sense board ,since both boards have the save processor and just different peripherals .

Dimitris







Problem with LPTIM on Zephyr

Raz <raziebe@...>
 

hello.
I am trying to use the LPTIM for the nucleos 476  by integrating it from CUBE. I ported the code below to Zephyr:

 HAL_Init();

  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_LPTIM1_Init();
  for (;i<2;i++) {
 HAL_GPIO_TogglePin (GPIOA, GPIO_PIN_5);
 HAL_Delay(1000);
  }
  /*
   * LSE Input freq is 32768 hz.
   *  32768/64 = 512hz
   * */
  int secs = 3;
  if (HAL_LPTIM_Counter_Start_IT(&hlptim1, 512* secs + 1) != HAL_OK) {
     Error_Handler();
  }
  HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
  while (1)
  {
 HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
  }
  /* USER C

However, the timer does not start. Anyone is familiar with this problem ?

Kind regards


SMT32F103 - RCC_CFGR_PLLXTPRE not set correctly?

immanuel narodoslawsky
 

Hi everyone,

I have troubles getting my custom board to work. I think the problem is that the RCC_CFGR_PLLXTPRE bit is not handled properly. I am using an STM32F103C8 (same as on the bluebill board) with an external 16MHz quartz. I am trying to run the system on 72MHz by dividing the input clock by 2.
Currently I am on Zephyr 2.4.0, but as far as I can see this is still the same for the latest version.

I saw that this config option was removed in commit 6b72fbae7c  since the HAL layer is supposed to handle this, but I can't quite see how.

If I follow the calls I end up in the LL_PLL_ConfigSystemClock_HSE HAL function that passes the "prediv" value from the PLL init struct to LL_RCC_PLL_ConfigDomain_SYS. As far as I can see it does not handle the shifting to the right position or any parsing of the "prediv" value.

But since this config option was removed on purpose I am wondering if I am doing something wrong here. What is the intended way of configuring this option?

Can you please let me know if anyone got this working?

Thanks a lot for your help!


Best regards,
Naro




Re: Cross compiling for AR71xx

Kumar Gala
 

On Feb 10, 2021, at 5:07 AM, Piotr Barszczewski <piotr@1am.pl> wrote:

Hello,

I am wondering that since among others Zephyr supports Intel x86 (32- and 64-bit) would it be theoretically possible to cross compile it to AR71xx architecture, quite popular as OpenWRT host? I’ve done that with other C/C++ projects and even golang library with ENV CGO_ENABLED=1 and CC= pointing to my mips-openwrt-linux-musl-gcc toolchain.
I would want to try it out but the amount of potential problems to overcome is quite significant so wanted I to ask if anyone has tried that before or knows where one could find more information about such an experiment?
The reason for that is that it could potentially unify my development stack consisting of nRF528xx chips for BLE running on Zephyr <-> gateway devices (this is where Zephyr on AR71xx comes in) <-> desktop apps which again can be written in Zephyr.
While technically possible there isn’t a port of Zephyr in the upstream code base for MIPS. There are some PRs for this but they haven’t gotten to a mergeable state.

In addition, as Zephyr is a RTOS it requires porting to the hardware you’re interested in running it on.

I suggest search for MIPS in the GitHub PR and issues for more details.

- k


Cross compiling for AR71xx

Piotr Barszczewski <piotr@...>
 

Hello,

I am wondering that since among others Zephyr supports Intel x86 (32- and 64-bit) would it be theoretically possible to cross compile it to AR71xx architecture, quite popular as OpenWRT host? I’ve done that with other C/C++ projects and even golang library with ENV CGO_ENABLED=1 and CC= pointing to my mips-openwrt-linux-musl-gcc toolchain.
I would want to try it out but the amount of potential problems to overcome is quite significant so wanted I to ask if anyone has tried that before or knows where one could find more information about such an experiment?
The reason for that is that it could potentially unify my development stack consisting of nRF528xx chips for BLE running on Zephyr <-> gateway devices (this is where Zephyr on AR71xx comes in) <-> desktop apps which again can be written in Zephyr. 

Best regards,
PB


Re: undefined reference to `__bswapdi2' when trying to link tinycbor for RISC-V

Kumar Gala
 

On Feb 8, 2021, at 1:16 PM, Stefan Hristozov <stefan.hristozov@aisec.fraunhofer.de> wrote:

Hi
I am using Zephyr version: 2.3.99 with West version: v0.7.2.

How to provide -Wl,--start-group …. -Wl,—end-group linker flags to my Zephyr project?
Try something like:

/opt/zephyr-sdk-0.11.3/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc … -Wl,--start-group zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/arch/riscv/core/offsets/offsets.c.obj -L"/opt/zephyr-sdk-0.11.3/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/9.2.0" -L/home/stefan/workspaces/oscore-edhoc/test/build/zephyr -lgcc -Wl,—end-group …

- k


Re: undefined reference to `__bswapdi2' when trying to link tinycbor for RISC-V

Stefan Hristozov
 

Hi
I am using Zephyr version: 2.3.99 with West version: v0.7.2.

How to provide -Wl,--start-group …. -Wl,—end-group linker flags to my Zephyr project?

Br,
Stefan


Re: Drift through k_sleep or k_msleep #api

Chruściński, Krzysztof
 

Hi,

One thing to consider is that k_timeout_t structure used for k_sleep and kernel timeouts can hold absolute value. Check out K_TIMEOUT_ABS_MS() for setting timeout in uptime milliseconds.

Regards,
Krzysztof

-----Original Message-----
From: users@lists.zephyrproject.org <users@lists.zephyrproject.org> On Behalf Of Nikolaus Huber via lists.zephyrproject.org
Sent: Wednesday, February 3, 2021 9:48 PM
To: users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] Drift through k_sleep or k_msleep #api

Thank you all for your answers!

I was kind of assuming that I could achieve this by using a timer. I think that that might be the nicest solution for my use case.
I was just wondering if Zephyr maybe has an API similar to FreeRTOS with a dedicated delay command that eliminates drifts. But I guess using a timer actually makes it a bit more explicit.

Thank you very much :)

/Nick








När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.uu.se%2Fom-uu%2Fdataskydd-personuppgifter%2F&;data=04%7C01%7Ckrzysztof.chruscinski%40nordicsemi.no%7C08dd3554ffe7423bee6008d8c8850e8a%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637479821084758635%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=oxxw9PeN6d36zfphV4A%2BLfiDszb8EIsfI3grkUvoSI4%3D&amp;reserved=0

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.uu.se%2Fen%2Fabout-uu%2Fdata-protection-policy&;data=04%7C01%7Ckrzysztof.chruscinski%40nordicsemi.no%7C08dd3554ffe7423bee6008d8c8850e8a%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637479821084758635%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=NUC%2B45wN6BAFk1jM%2B9tA6bXx8fHZLt7%2FNNp%2BTh%2FIQz4%3D&amp;reserved=0


Re: Drift through k_sleep or k_msleep #api

Nikolaus Huber
 

Thank you all for your answers!

I was kind of assuming that I could achieve this by using a timer. I think that that might be the nicest solution for my use case.
I was just wondering if Zephyr maybe has an API similar to FreeRTOS with a dedicated delay command that eliminates drifts. But I guess using a timer actually makes it a bit more explicit.

Thank you very much :)

/Nick








När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy


Re: Drift through k_sleep or k_msleep #api

Erik Englund
 

I guess the internals of this uses a semaphore aswell to get realtime performance.

If you control the semaphore yourself as per my example, you can check the status of the semaphore in the end of the function to see if the timer has expired while the work was running, if so, you have a realtime problem.
We use this technique in Zephyr within a few PLC-type controller products, using 1000 ticks/second rate and cycletime of 10ms.

Med vänlig hälsning
Erik Englund

Innoware Development AB
Hyttvägen 13
73338 SALA


Org.nr. 556790-2977
www.innoware.se


Den ons 3 feb. 2021 kl 21:10 skrev Michael Rosen <michael.r.rosen@...>:

Nick,

 

The design pattern Ive seen for this kind of thing uses the Timer API instead of sleep:

 

struct k_timer timer;

k_timer_init(&timer, NULL, NULL);

k_timer_start(&timer, 0, K_MSEC(1000));

while (1) {

  k_timer_status_sync(&timer);

  …

}

 

This lets the body of the main loop run only when the timer expires, and the periodic timer avoid drift from resetting the timer at the top of each loop.

 

Mike

 

From: users@... <users@...> On Behalf Of Erik Englund
Sent: Wednesday, February 3, 2021 2:38 PM
To: Nikolaus Huber <nikolaus.huber@...>
Cc: users@...
Subject: Re: [Zephyr-users] Drift through k_sleep or k_msleep #api

 

One possible solution is to create a periodic timer and post to a semaphore in the timer callback.

A thread could simply wait on the semaphore in an endless loop.

 

Linux clock_nanosleep (mostly used togheter with Preempt-rt patch) would be a nice addition to Zephyr, that would solve these kinds of tasks.


Med vänlig hälsning

Erik Englund


Innoware Development AB
Hyttvägen 13
73338 SALA


Org.nr. 556790-2977
www.innoware.se

 

 

Den ons 3 feb. 2021 kl 20:31 skrev Nikolaus Huber <nikolaus.huber@...>:

Hi all, 

I was recently wondering about the correct usage of k_sleep or k_msleep for implementing periodic tasks. In FreeRTOS for example there is a function vTaskDelayUntil which takes a timestamp and a number of ticks to delay. By taking the timestamp at the beginning of the execution of a task we can then make sure that its release time does not slowly drift. So far I have not seen anything similar in Zephyr. Am I missing something, or do I have to somehow create a similar mechanism on my own by measuring the uptime at the release of a periodic task and then again just before using any sleep function to calculate the exact sleep time I want?

Thank you very much in advance,
Nick


Re: Drift through k_sleep or k_msleep #api

Michael Rosen
 

Nick,

 

The design pattern Ive seen for this kind of thing uses the Timer API instead of sleep:

 

struct k_timer timer;

k_timer_init(&timer, NULL, NULL);

k_timer_start(&timer, 0, K_MSEC(1000));

while (1) {

  k_timer_status_sync(&timer);

  …

}

 

This lets the body of the main loop run only when the timer expires, and the periodic timer avoid drift from resetting the timer at the top of each loop.

 

Mike

 

From: users@... <users@...> On Behalf Of Erik Englund
Sent: Wednesday, February 3, 2021 2:38 PM
To: Nikolaus Huber <nikolaus.huber@...>
Cc: users@...
Subject: Re: [Zephyr-users] Drift through k_sleep or k_msleep #api

 

One possible solution is to create a periodic timer and post to a semaphore in the timer callback.

A thread could simply wait on the semaphore in an endless loop.

 

Linux clock_nanosleep (mostly used togheter with Preempt-rt patch) would be a nice addition to Zephyr, that would solve these kinds of tasks.


Med vänlig hälsning

Erik Englund


Innoware Development AB
Hyttvägen 13
73338 SALA


Org.nr. 556790-2977
www.innoware.se

 

 

Den ons 3 feb. 2021 kl 20:31 skrev Nikolaus Huber <nikolaus.huber@...>:

Hi all, 

I was recently wondering about the correct usage of k_sleep or k_msleep for implementing periodic tasks. In FreeRTOS for example there is a function vTaskDelayUntil which takes a timestamp and a number of ticks to delay. By taking the timestamp at the beginning of the execution of a task we can then make sure that its release time does not slowly drift. So far I have not seen anything similar in Zephyr. Am I missing something, or do I have to somehow create a similar mechanism on my own by measuring the uptime at the release of a periodic task and then again just before using any sleep function to calculate the exact sleep time I want?

Thank you very much in advance,
Nick


Re: Drift through k_sleep or k_msleep #api

Lawrence King
 

When I need work to operate on a regular basis and not drift I create a work queue and a timer that is setup to submit the work to the queue on a regular basis. This way it doesn’t matter how long it takes to finish the work, the next work run will still start at exactly the right time. main() calls  clock_init() to get this started…

 

 

#include <stdio.h>

#include <stddef.h>

#include <stdint.h>

#include <zephyr.h>

#include <zephyr/types.h>

 

#define TIME_INC_FREQUENCY      10      // in secs

 

void my_work_handler(struct k_work *work)

{

     // do whatever here

}

 

K_WORK_DEFINE(my_work, my_work_handler);

 

void my_timer_handler(struct k_timer *dummy)

{

    k_work_submit(&my_work);

}

 

K_TIMER_DEFINE(my_timer, my_timer_handler, NULL);

 

void clock_init(void) {

    k_timer_start(&my_timer, K_SECONDS(TIME_INC_FREQUENCY), K_SECONDS(TIME_INC_FREQUENCY));

}

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: users@... <users@...> On Behalf Of Erik Englund
Sent: Wednesday, February 3, 2021 2:38 PM
To: Nikolaus Huber <nikolaus.huber@...>
Cc: users@...
Subject: Re: [Zephyr-users] Drift through k_sleep or k_msleep #api

 

One possible solution is to create a periodic timer and post to a semaphore in the timer callback.

A thread could simply wait on the semaphore in an endless loop.

 

Linux clock_nanosleep (mostly used togheter with Preempt-rt patch) would be a nice addition to Zephyr, that would solve these kinds of tasks.


Med vänlig hälsning

Erik Englund


Innoware Development AB
Hyttvägen 13
73338 SALA


Org.nr. 556790-2977
www.innoware.se

 

 

Den ons 3 feb. 2021 kl 20:31 skrev Nikolaus Huber <nikolaus.huber@...>:

Hi all, 

I was recently wondering about the correct usage of k_sleep or k_msleep for implementing periodic tasks. In FreeRTOS for example there is a function vTaskDelayUntil which takes a timestamp and a number of ticks to delay. By taking the timestamp at the beginning of the execution of a task we can then make sure that its release time does not slowly drift. So far I have not seen anything similar in Zephyr. Am I missing something, or do I have to somehow create a similar mechanism on my own by measuring the uptime at the release of a periodic task and then again just before using any sleep function to calculate the exact sleep time I want?

Thank you very much in advance,
Nick


Re: Drift through k_sleep or k_msleep #api

Erik Englund
 

One possible solution is to create a periodic timer and post to a semaphore in the timer callback.
A thread could simply wait on the semaphore in an endless loop.

Linux clock_nanosleep (mostly used togheter with Preempt-rt patch) would be a nice addition to Zephyr, that would solve these kinds of tasks.

Med vänlig hälsning
Erik Englund

Innoware Development AB
Hyttvägen 13
73338 SALA


Org.nr. 556790-2977
www.innoware.se


Den ons 3 feb. 2021 kl 20:31 skrev Nikolaus Huber <nikolaus.huber@...>:

Hi all, 

I was recently wondering about the correct usage of k_sleep or k_msleep for implementing periodic tasks. In FreeRTOS for example there is a function vTaskDelayUntil which takes a timestamp and a number of ticks to delay. By taking the timestamp at the beginning of the execution of a task we can then make sure that its release time does not slowly drift. So far I have not seen anything similar in Zephyr. Am I missing something, or do I have to somehow create a similar mechanism on my own by measuring the uptime at the release of a periodic task and then again just before using any sleep function to calculate the exact sleep time I want?

Thank you very much in advance,
Nick


Drift through k_sleep or k_msleep #api

Nikolaus Huber
 

Hi all, 

I was recently wondering about the correct usage of k_sleep or k_msleep for implementing periodic tasks. In FreeRTOS for example there is a function vTaskDelayUntil which takes a timestamp and a number of ticks to delay. By taking the timestamp at the beginning of the execution of a task we can then make sure that its release time does not slowly drift. So far I have not seen anything similar in Zephyr. Am I missing something, or do I have to somehow create a similar mechanism on my own by measuring the uptime at the release of a periodic task and then again just before using any sleep function to calculate the exact sleep time I want?

Thank you very much in advance,
Nick


Re: Azure MQTT with GSM modem over PPP #mqtt #modem #ppp #nrf52840

Jukka Rissanen
 

Hi Jurgens,

have you tried to connect to Azure using for example qemu, this way we could rule out issues in modem config?

I did not spot anything obviously wrong in your main.c, but as you have noticed, there are lot of moving parts when connecting to azure using mqtt, so it can be challenging to get things right.


Cheers,
Jukka



On Wed, 2021-02-03 at 03:00 -0800, petrus.vanderwalt@... wrote:
Hi everyone,

I am really struggling to get the mqtt_azure sample working.  It just does not want to connect to IoT hub.

Thank you once again for your assistance @Jukka.  Can anyone help me to get this working?  I am not sure if the issue is related to Azure details that are different from what is recommended by Microsoft or if it is an issue due to using a modem overlay.  

I would really appreciate it if someone could help me get this working.  I have added the project files that have changed.

Regards,
Jurgens


Re: Azure MQTT with GSM modem over PPP #mqtt #modem #ppp #nrf52840

petrus.vanderwalt@...
 

Hi everyone,

I am really struggling to get the mqtt_azure sample working.  It just does not want to connect to IoT hub.

Thank you once again for your assistance @Jukka.  Can anyone help me to get this working?  I am not sure if the issue is related to Azure details that are different from what is recommended by Microsoft or if it is an issue due to using a modem overlay.  

I would really appreciate it if someone could help me get this working.  I have added the project files that have changed.

Regards,
Jurgens


Re: undefined reference to `__bswapdi2' when trying to link tinycbor for RISC-V

Kumar Gala
 

On Jan 29, 2021, at 1:42 PM, Stefan Hristozov <stefan.hristozov@aisec.fraunhofer.de> wrote:

I am getting undefined reference to `__bswapdi2' when I am trying to link tinycbor for RISC-V (west build -b=hifive1)
stefan@t460s:~/workspaces/oscore-edhoc/test$ west build -b=hifive1
[1/5] Linking C executable zephyr/zephyr_prebuilt.elf
FAILED: zephyr/zephyr_prebuilt.elf
: && ccache /opt/zephyr-sdk-0.11.3/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr/zephyr_prebuilt.elf -Wl,-T zephyr/linker.cmd -Wl,-Map=/home/stefan/workspaces/oscore-edhoc/test/build/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/riscv/core/libarch__riscv__core.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/lib/posix/liblib__posix.a zephyr/boards/riscv/hifive1/libboards__riscv__hifive1.a zephyr/subsys/testsuite/ztest/libsubsys__testsuite__ztest.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/spi/libdrivers__spi.a zephyr/drivers/serial/libdrivers__serial.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/arch/riscv/core/offsets/offsets.c.obj -L"/opt/zephyr-sdk-0.11.3/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/9.2.0" -L/home/stefan/workspaces/oscore-edhoc/test/build/zephyr -lgcc -Wl,--print-memory-usage ../build_lib_test/libtest.a -mabi=ilp32 -march=rv32ima -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn && :
Memory region Used Size Region Size %age Used
ROM: 73756 B 12 MB 0.59%
RAM: 15600 B 16 KB 95.21%
IDT_LIST: 553 B 2 KB 27.00/opt/zephyr-sdk-0.11.3/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/9.2.0/../../../../riscv64-zephyr-elf/bin/ld: ../build_lib_test/libtest.a(cborencoder.o): in function `put64':
/home/stefan/workspaces/oscore-edhoc/test/lib_test/../../externals/tinycbor/src/cborencoder.c:255: undefined reference to `__bswapdi2'
collect2: error: ld returned 1 exit status
%
ninja: build stopped: subcommand failed.
With grep I can see that this function is available in libgcc.a for RISC-V
stefan@t460s:/opt/zephyr-sdk-0.11.3/riscv64-zephyr-elf$ grep -nrw '__bswapdi2'
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/rv32i/ilp32/libgcc.a matches
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/rv32iac/ilp32/libgcc.a matches
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/libgcc.a matches
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/rv32imac/ilp32/libgcc.a matches
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/rv64imafdc/lp64d/medany/libgcc.a matches
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/rv64imafdc/lp64d/libgcc.a matches
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/rv32imafc/ilp32f/libgcc.a matches
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/rv32im/ilp32/libgcc.a matches
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/rv64imac/lp64/medany/libgcc.a matches
Binary file lib/gcc/riscv64-zephyr-elf/9.2.0/rv64imac/lp64/libgcc.a matches
Binary file libexec/gcc/riscv64-zephyr-elf/9.2.0/lto1 matches
Binary file libexec/gcc/riscv64-zephyr-elf/9.2.0/cc1 matches
Binary file libexec/gcc/riscv64-zephyr-elf/9.2.0/cc1plus matches
How to tell my zephyr project to use libgcc?
Based on the gcc line, you are getting libgcc pulled in via -L"/opt/zephyr-sdk-0.11.3/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/9.2.0” and -lgcc.

What version of zephyr are you using? Have you tried running the link with a -Wl,--start-group …. -Wl,—end-group?

- k

161 - 180 of 2599