Date   

Re: how to provide own out of tree implementation/replacement of existing driver

Jan Pohanka
 

Hello,
yes, but I'm afraid that this would work only in simplest cases eg.
when an in-tree driver is not selected as dependency etc...

út 16. 6. 2020 v 23:07 odesílatel Bolivar, Marti
<Marti.Bolivar@nordicsemi.no> napsal:


Hi,

You should be able to just disable the in-tree driver using Kconfig and
use your own out of tree driver.

"Jan Pohanka via lists.zephyrproject.org"
<xhpohanka=gmail.com@lists.zephyrproject.org> writes:

Hello,

I would like to use my own implementation of an existing driver. Is
there any way to do that? I have found an amend feature in
https://github.com/zephyrproject-rtos/zephyr/pull/19980 but I cannot
make it work. If I understand correctly it is intended more to add
some functionality than completely replace.
In my use-case it would be probably easier to use out of tree
implementation for some time than maintain patches for the main tree.
In fact I need just to add support for new soc from the stm32 family
that is not yet in existing drivers (clock, watchdog, ethernet, etc).
Later when our code is polished, I will prepare pull-requests.

best regards
Jan


Re: Seeed BLE Micro (nrf51822) hangs on k_msleep

Chettimada, Vinayak Kariappa
 

Hi Matias,

 

Please create a github issue detailing the steps to reproduce, please mention the diff/changes of the upstream master samples you are using. Also upload the “.config” file of your build.

You can assign it to me, for starters.’

 

That said, be stuck at sleep/WFI indicates stopped 32KHz clock due to missing/damaged external crystal and misconfigure LFCLOCK source.

 

Regards,

Vinayak

 

From: users@... <users@...> On Behalf Of Matias N. via lists.zephyrproject.org
Sent: 16 June 2020 23:29
To: Vinayak Kariappa <vinayak.kariappa@...>
Cc: users@...
Subject: Re: [Zephyr-users] Seeed BLE Micro (nrf51822) hangs on k_msleep

 

Hi,

sorry for the delay. I just tried your suggestion and it does not seem to make a difference. As I mentioned, on debugging it seems to be halted at the WFI instruction. From my understanding, there should be an interrupt firing via the RTC but this is not happening and the MCU does not get out of the WFI (I placed a breakpoint at the rtc1_nfr_isr) and it never reaches there.

 

I also tried to simply modify the in-tree board definition for BLE nano, changing the LED gpio pin and setting the appropriate UART pins for my board and then flashing the blinky sample. I got the same result of the LED staying fixed.

 

Furthermore, the board came with nordic's UART/BLE demonstration firmware and this works (I can bind from my phone) so I would rule out defective hardware.

 

I can't really understand what could be happening. Any idea on what I should try?

 

Best,

Matias

 

On Wed, Jun 10, 2020, at 21:42, Vinayak Kariappa wrote:

Hi Matias,

 

From the schematics posted in seedstudio website, indeed a 32KHz crystal is said to be present. You may always use the internal 32 KHz RC oscillator in nRF51 to check if the system timer is not the problem.

 

Enable the following to use RC Oscillator:

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

 

16MHz clock is essential for 2.4 GHz radio peripheral.

 

Regards,

Vinayak

 

On Sat, Jun 6, 2020 at 5:31 AM Matias N. <matias@...> wrote:

 

Hi,

I'm starting a project based on the BLE Micro module from Seeedstudio. Since this "board" was not supported but the RedBear BLE nano board is the most similar one, I created a custom board directory for it using this as a template. I managed to flash the blinky sample to the module (using openocd and a ST-Link v2 clone device) and can also connect with gdb to debug. I have this module soldered to a custom PCB which features a LED and thus I set the correct LED GPIO in the dts file. I managed to control the LED but from my debugging it seems to hang when calling k_msleep(). When it hangs, if I pause the execution it appears to be right after the "wfi" instruction (i'm assuming the debugger breaks the sleep).

 

I'm not sure why this could be happening. My guess it is something to do with the clock configuration. The module features a 32.768hz crystal (just like the BLE Nano) but also a 16 MHz crystal (which I'm not sure is used or not by zephyr). I tried disabling tickless, but the behavior does not change.

 

As I'm new to zephyr I'm not quite sure what else to check. Googling for this problem I found old issues in GitHub relating to tickless mode, low-power, rtc, etc. But all seem to be merged/closed. I would appreciate any help in this.

 

Best,

Matias

 

 

 


Re: Seeed BLE Micro (nrf51822) hangs on k_msleep

Matias N.
 

Hi,
sorry for the delay. I just tried your suggestion and it does not seem to make a difference. As I mentioned, on debugging it seems to be halted at the WFI instruction. From my understanding, there should be an interrupt firing via the RTC but this is not happening and the MCU does not get out of the WFI (I placed a breakpoint at the rtc1_nfr_isr) and it never reaches there.

I also tried to simply modify the in-tree board definition for BLE nano, changing the LED gpio pin and setting the appropriate UART pins for my board and then flashing the blinky sample. I got the same result of the LED staying fixed.

Furthermore, the board came with nordic's UART/BLE demonstration firmware and this works (I can bind from my phone) so I would rule out defective hardware.

I can't really understand what could be happening. Any idea on what I should try?

Best,
Matias

On Wed, Jun 10, 2020, at 21:42, Vinayak Kariappa wrote:
Hi Matias,

From the schematics posted in seedstudio website, indeed a 32KHz crystal is said to be present. You may always use the internal 32 KHz RC oscillator in nRF51 to check if the system timer is not the problem.

Enable the following to use RC Oscillator:
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

16MHz clock is essential for 2.4 GHz radio peripheral.

Regards,
Vinayak

On Sat, Jun 6, 2020 at 5:31 AM Matias N. <matias@...> wrote:

Hi,
I'm starting a project based on the BLE Micro module from Seeedstudio. Since this "board" was not supported but the RedBear BLE nano board is the most similar one, I created a custom board directory for it using this as a template. I managed to flash the blinky sample to the module (using openocd and a ST-Link v2 clone device) and can also connect with gdb to debug. I have this module soldered to a custom PCB which features a LED and thus I set the correct LED GPIO in the dts file. I managed to control the LED but from my debugging it seems to hang when calling k_msleep(). When it hangs, if I pause the execution it appears to be right after the "wfi" instruction (i'm assuming the debugger breaks the sleep).

I'm not sure why this could be happening. My guess it is something to do with the clock configuration. The module features a 32.768hz crystal (just like the BLE Nano) but also a 16 MHz crystal (which I'm not sure is used or not by zephyr). I tried disabling tickless, but the behavior does not change.

As I'm new to zephyr I'm not quite sure what else to check. Googling for this problem I found old issues in GitHub relating to tickless mode, low-power, rtc, etc. But all seem to be merged/closed. I would appreciate any help in this.

Best,
Matias





Re: Git submodules with West #west

Bolivar, Marti
 

Hi,

Right now, the only way to handle submodules with west is the way you're
currently doing it. If you are interested in submitting a PR with
support, I think it'd make sense to add. The only wrinkle is that west
"clones" repositories by combining git init + fetch + checkout instead
of actually running git clone.

"mike via lists.zephyrproject.org"
<mike=rokkresearch.com@lists.zephyrproject.org> writes:

Hi,

I have a Zephyr project set up as a manifest repository, and I'm trying to include a git repository that makes use of submodules.  i.e., I would normally clone this repository with:


git clone --recursive
Is there a way to specify this from west.yml?  I was able to manually add the sub-module by specifying a new project containing the sub-module in west.yml, and using the 'path' specifier to put it underneath the top level git repo.  But, I'm wondering if there's a way to do this without having to manually add all of the sub-modules to west.yml.   Thanks in advance.


Re: how to provide own out of tree implementation/replacement of existing driver

Bolivar, Marti
 

Hi,

You should be able to just disable the in-tree driver using Kconfig and
use your own out of tree driver.

"Jan Pohanka via lists.zephyrproject.org"
<xhpohanka=gmail.com@lists.zephyrproject.org> writes:

Hello,

I would like to use my own implementation of an existing driver. Is
there any way to do that? I have found an amend feature in
https://github.com/zephyrproject-rtos/zephyr/pull/19980 but I cannot
make it work. If I understand correctly it is intended more to add
some functionality than completely replace.
In my use-case it would be probably easier to use out of tree
implementation for some time than maintain patches for the main tree.
In fact I need just to add support for new soc from the stm32 family
that is not yet in existing drivers (clock, watchdog, ethernet, etc).
Later when our code is polished, I will prepare pull-requests.

best regards
Jan


how to provide own out of tree implementation/replacement of existing driver

Jan Pohanka
 

Hello,

I would like to use my own implementation of an existing driver. Is
there any way to do that? I have found an amend feature in
https://github.com/zephyrproject-rtos/zephyr/pull/19980 but I cannot
make it work. If I understand correctly it is intended more to add
some functionality than completely replace.
In my use-case it would be probably easier to use out of tree
implementation for some time than maintain patches for the main tree.
In fact I need just to add support for new soc from the stm32 family
that is not yet in existing drivers (clock, watchdog, ethernet, etc).
Later when our code is polished, I will prepare pull-requests.

best regards
Jan


API meeting: agenda

Carles Cufi
 


Git submodules with West #west

mike@...
 

Hi,

I have a Zephyr project set up as a manifest repository, and I'm trying to include a git repository that makes use of submodules.  i.e., I would normally clone this repository with:
git clone --recursive
Is there a way to specify this from west.yml?  I was able to manually add the sub-module by specifying a new project containing the sub-module in west.yml, and using the 'path' specifier to put it underneath the top level git repo.  But, I'm wondering if there's a way to do this without having to manually add all of the sub-modules to west.yml.   Thanks in advance.


Re: BLE "Just-Works" configuration

Jeremy Herbert
 

I ended up resolving this, it was to do with the previous bond information being stored. The following two configs fixed it:

CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE=y

Note that this is an insecure configuration, CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE allows a possible forced deauth and reauth MITM attack. But for testing it works fine.

Thanks,
Jeremy

On Sat, 13 Jun 2020 at 12:34, Jeremy Herbert via lists.zephyrproject.org <jeremy.006=gmail.com@...> wrote:
Hi,

I'm trying to set up Zephyr as a BLE peripheral with an nrf52810. I have the peripheral_hids example running fine, including bonding with the passkey being printed out over printk. However, my actual end device doesn't have any input/output other than a few buttons, so I'd like to change this to use "Just-Works" pairing so it can at least bond and have encrypted communication but not have MITM protection (ie BT_SECURITY_L2). I can't seem to find much documentation on implementing this scenario using Zephyr, so I was wondering if there is an example available on exactly what to do for this type of pairing/bonding where no input/output is available?

I did give it a try myself based on this example, but I am a bit stuck. I have tried setting the bt_conn_auth_cb members all to NULL, as well as changing the GATT entry permissions to BT_GATT_PERM_READ_ENCRYPT instead of BT_GATT_PERM_READ_AUTHEN (I also did the same for the BT_GATT_PERM_WRITE_AUTHEN).

When connecting and bonding with an android device (I'm using the nRF connect app), it asks to pair, but then on continuing with this it fails. In the debug log from the device I can see (I removed the MAC address):


Security failed: XX:XX:XX:XX:XX:XX (public) level 1 err 4

Disconnected from XX:XX:XX:XX:XX:XX (public) (reason 0x13)


where error code 4 is BT_SMP_ERR_CONFIRM_FAILED. I also tried setting a pairing_confirm callback in the bt_conn_auth_cb struct which just confirms the connection by calling bt_conn_auth_pairing_confirm(), but it doesn't appear to make a difference.

Any pointers would be appreciated.

Thanks,
Jeremy


BLE "Just-Works" configuration

Jeremy Herbert
 

Hi,

I'm trying to set up Zephyr as a BLE peripheral with an nrf52810. I have the peripheral_hids example running fine, including bonding with the passkey being printed out over printk. However, my actual end device doesn't have any input/output other than a few buttons, so I'd like to change this to use "Just-Works" pairing so it can at least bond and have encrypted communication but not have MITM protection (ie BT_SECURITY_L2). I can't seem to find much documentation on implementing this scenario using Zephyr, so I was wondering if there is an example available on exactly what to do for this type of pairing/bonding where no input/output is available?

I did give it a try myself based on this example, but I am a bit stuck. I have tried setting the bt_conn_auth_cb members all to NULL, as well as changing the GATT entry permissions to BT_GATT_PERM_READ_ENCRYPT instead of BT_GATT_PERM_READ_AUTHEN (I also did the same for the BT_GATT_PERM_WRITE_AUTHEN).

When connecting and bonding with an android device (I'm using the nRF connect app), it asks to pair, but then on continuing with this it fails. In the debug log from the device I can see (I removed the MAC address):


Security failed: XX:XX:XX:XX:XX:XX (public) level 1 err 4

Disconnected from XX:XX:XX:XX:XX:XX (public) (reason 0x13)


where error code 4 is BT_SMP_ERR_CONFIRM_FAILED. I also tried setting a pairing_confirm callback in the bt_conn_auth_cb struct which just confirms the connection by calling bt_conn_auth_pairing_confirm(), but it doesn't appear to make a difference.

Any pointers would be appreciated.

Thanks,
Jeremy


WiFi support configuration issue.

rdsingh@...
 

If any of the WiFi drivers (WINC1500 given here) are selected with guiconfig, we get Kconfig warning as follows -

  - WIFI_WINC1500 (defined at drivers/wifi/winc1500/Kconfig.winc1500:6), with value y, direct dependencies WIFI (value: y), and select condition WIFI (value: y)
warning: NET_OFFLOAD (defined at subsys/net/ip/Kconfig:39) has direct dependencies NETWORKING with value n, but is currently being y-selected by the following symbols:
 - WIFI_OFFLOAD (defined at drivers/wifi/Kconfig:26), with value y, direct dependencies WIFI (value: y), and select condition WIFI (value: y)
Configuration saved to '/home/rdsingh/zephyrproject/zephyr/build/zephyr/.config'

If this warning is ignored and configuration saved, build fails with the following message -

warning: NET_L2_WIFI_MGMT (defined at subsys/net/l2/Kconfig:79) has direct dependencies NETWORKING with value n, but is currently being y-selected by the following symbols:
 - WIFI_WINC1500 (defined at drivers/wifi/winc1500/Kconfig.winc1500:6), with value y, direct dependencies WIFI (value: y), and select condition WIFI (value: y)

warning: NET_OFFLOAD (defined at subsys/net/ip/Kconfig:39) has direct dependencies NETWORKING with value n, but is currently being y-selected by the following symbols:
 - WIFI_OFFLOAD (defined at drivers/wifi/Kconfig:26), with value y, direct dependencies WIFI (value: y), and select condition WIFI (value: y)

error: Aborting due to Kconfig warnings

CMake Error at /home/rdsingh/zephyrproject/zephyr/cmake/kconfig.cmake:217 (message):
  command failed with return code: 1

Could anyone tell me what is going on?

best regards,
RDS


Post 2.3.0 PR merging

Carles Cufi
 

Hi all,

We currently have 170+ Pull Requests that pass CI but require one or more approvals in order to be merged, in part due to the fact that we have increased the minimum number of approvals required from 1 to 2.

Help reviewing those PRs is greatly appreciated:

https://github.com/zephyrproject-rtos/zephyr/pulls?q=is%3Apr+is%3Aopen+base%3Amaster+review%3Arequired+status%3Asuccess+-label%3ADNM+draft%3Afalse

Thanks,

Carles


Whether the fifth parameter of settings_line_entry_copy can be 0

istuoli@...
 

Hello!
     I wonder if the fifth parameter of settings_line_entry_copy in subsys/settings/src/settings_line.c can be 0. If so, rc may be uninitialized.
 
Regards,
Tuo


Re: Seeed BLE Micro (nrf51822) hangs on k_msleep

Vinayak Kariappa
 

Hi Matias,

From the schematics posted in seedstudio website, indeed a 32KHz crystal is said to be present. You may always use the internal 32 KHz RC oscillator in nRF51 to check if the system timer is not the problem.

Enable the following to use RC Oscillator:
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

16MHz clock is essential for 2.4 GHz radio peripheral.

Regards,
Vinayak


On Sat, Jun 6, 2020 at 5:31 AM Matias N. <matias@...> wrote:
Hi,
I'm starting a project based on the BLE Micro module from Seeedstudio. Since this "board" was not supported but the RedBear BLE nano board is the most similar one, I created a custom board directory for it using this as a template. I managed to flash the blinky sample to the module (using openocd and a ST-Link v2 clone device) and can also connect with gdb to debug. I have this module soldered to a custom PCB which features a LED and thus I set the correct LED GPIO in the dts file. I managed to control the LED but from my debugging it seems to hang when calling k_msleep(). When it hangs, if I pause the execution it appears to be right after the "wfi" instruction (i'm assuming the debugger breaks the sleep).

I'm not sure why this could be happening. My guess it is something to do with the clock configuration. The module features a 32.768hz crystal (just like the BLE Nano) but also a 16 MHz crystal (which I'm not sure is used or not by zephyr). I tried disabling tickless, but the behavior does not change.

As I'm new to zephyr I'm not quite sure what else to check. Googling for this problem I found old issues in GitHub relating to tickless mode, low-power, rtc, etc. But all seem to be merged/closed. I would appreciate any help in this.

Best,
Matias


Re: CONFIG_HEAP_MEM_POOL_SIZE

Andy Ross
 

I thought I fixed the docs, but it looks like that text is in kconfig?

The original mem_pool code had a hard requirement that the memory region be a power of four larger than the smallest allocation unit.  That was relaxed a while back so that odd sizes would work, though at the cost of some fragmentation.  And now the whole mem_pool implementation has been replaced as the default by a newer heap that has more conventional behavior and is more flexible with memory regions and more fragmentation resistant.  You have to ask (via kconfig) to get the old backend now, the same API is pointing to wrappers.

So yes: pretty much any size will work fine for default code in the current tree.  There are a few dragons still though, like the fact that CONFIG_HEAP_MEM_POOL_SIZE is actually padded significantly before it becomes a byte array in your image (because it specifies what in the old scheme was the block of "live" memory, and the old mem_pool would then allocate a completely separate array for metadata that wasn't accounted for).

Andy

On 6/9/2020 12:34 AM, Armand C. wrote:

Hello,

I'm using Zephyr 2.2.0 and I would like to configure a heap size greater than 16kB but the documentation for CONFIG_HEAP_MEM_POOL_SIZE says that Supported values are: 256, 1024, 4096, and 16384. If I configure a higher value (e.g. 102400) it works but I'm afraid of possible side-effect.

Does someone know if it is safe to use other values than the one documented?

Regards,

Armand C.


CONFIG_HEAP_MEM_POOL_SIZE

Armand C. <rnx.lab@...>
 

Hello,

I'm using Zephyr 2.2.0 and I would like to configure a heap size greater than 16kB but the documentation for CONFIG_HEAP_MEM_POOL_SIZE says that Supported values are: 256, 1024, 4096, and 16384. If I configure a higher value (e.g. 102400) it works but I'm afraid of possible side-effect.

Does someone know if it is safe to use other values than the one documented?

Regards,

Armand C.


Re: API meeting: agenda

Carles Cufi
 

Hi all,

A small addition to the agenda:

- PWM: add functions for capturing pwm pulse width and period
- Issue: https://github.com/zephyrproject-rtos/zephyr/issues/26026

Carles

-----Original Message-----
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org> On
Behalf Of Carles Cufi via lists.zephyrproject.org
Sent: 09 June 2020 10:35
To: users@lists.zephyrproject.org; devel@lists.zephyrproject.org
Cc: Snekvik, Trond Einar <Trond.Einar.Snekvik@nordicsemi.no>
Subject: [Zephyr-devel] API meeting: agenda

Hi all,

*************************************************
We will be using Teams instead of Zoom:
https://teams.microsoft.com/l/meetup-
join/19%3ameeting_YzYzZTAzNGItOWFiMS00MDBkLTkyYmMtNzljZjkwNDVlMThm%40thr
ead.v2/0?context=%7b%22Tid%22%3a%22686ea1d3-bc2b-4c6f-a92c-
d99c5c301635%22%2c%22Oid%22%3a%2262b63b80-05d3-4465-b5a0-
f04e4e156f10%22%7d
*************************************************

Today's topics:

- PWM: Clarify expected behavior
- PR https://github.com/zephyrproject-rtos/zephyr/pull/25587

- API Change: Call UART_RX_RDY event after rx_disable()
- Issue https://github.com/zephyrproject-rtos/zephyr/issues/25317
- PR https://github.com/zephyrproject-rtos/zephyr/pull/25967

- API Change: Mesh: Add name parameter
- Issue https://github.com/zephyrproject-rtos/zephyr/issues/26037

Additional topics to review and close:

- QSPI flash drivers:
- Should we revisit the common QSPI API?
https://github.com/zephyrproject-rtos/zephyr/pull/20069
- Should it be part of the current SPI API?
https://github.com/zephyrproject-rtos/zephyr/issues/17902
- If not, should we try to unify the common functionality in the
multiple QSPI flash drivers?
- https://github.com/zephyrproject-rtos/zephyr/pull/25806
- https://github.com/zephyrproject-rtos/zephyr/pull/25669

- SPI JEDEC runtime support
- PR https://github.com/zephyrproject-rtos/zephyr/pull/23658

- RTC API follow-up (if the relevant people are present and there is
material for discussion)
- PR: https://github.com/zephyrproject-rtos/zephyr/pull/23526

Pending additional investigation:
- Documenting API behavior in Doxygen:
- Issue: https://github.com/zephyrproject-rtos/zephyr/issues/18970
- Issue: https://github.com/zephyrproject-rtos/zephyr/issues/21061

Additional items in the "Triage" column in the GitHub project may be
discussed if time permits.
If you want an item included in the meeting, please add it to the GitHub
project.

https://github.com/zephyrproject-rtos/zephyr/wiki/Zephyr-Committee-and-
Working-Group-Meetings#zephyr-api-discussion
https://github.com/zephyrproject-rtos/zephyr/projects/18
https://docs.google.com/document/d/1lv-
8B5QE2m4FjBcvfqAXFIgQfW5oz6306zJ7GIZIWCk/edit

Regards,

Carles



API meeting: agenda

Carles Cufi
 

Hi all,

*************************************************
We will be using Teams instead of Zoom:
https://teams.microsoft.com/l/meetup-join/19%3ameeting_YzYzZTAzNGItOWFiMS00MDBkLTkyYmMtNzljZjkwNDVlMThm%40thread.v2/0?context=%7b%22Tid%22%3a%22686ea1d3-bc2b-4c6f-a92c-d99c5c301635%22%2c%22Oid%22%3a%2262b63b80-05d3-4465-b5a0-f04e4e156f10%22%7d
*************************************************

Today's topics:

- PWM: Clarify expected behavior
- PR https://github.com/zephyrproject-rtos/zephyr/pull/25587

- API Change: Call UART_RX_RDY event after rx_disable()
- Issue https://github.com/zephyrproject-rtos/zephyr/issues/25317
- PR https://github.com/zephyrproject-rtos/zephyr/pull/25967

- API Change: Mesh: Add name parameter
- Issue https://github.com/zephyrproject-rtos/zephyr/issues/26037

Additional topics to review and close:

- QSPI flash drivers:
- Should we revisit the common QSPI API? https://github.com/zephyrproject-rtos/zephyr/pull/20069
- Should it be part of the current SPI API? https://github.com/zephyrproject-rtos/zephyr/issues/17902
- If not, should we try to unify the common functionality in the multiple QSPI flash drivers?
- https://github.com/zephyrproject-rtos/zephyr/pull/25806
- https://github.com/zephyrproject-rtos/zephyr/pull/25669

- SPI JEDEC runtime support
- PR https://github.com/zephyrproject-rtos/zephyr/pull/23658

- RTC API follow-up (if the relevant people are present and there is material for discussion)
- PR: https://github.com/zephyrproject-rtos/zephyr/pull/23526

Pending additional investigation:
- Documenting API behavior in Doxygen:
- Issue: https://github.com/zephyrproject-rtos/zephyr/issues/18970
- Issue: https://github.com/zephyrproject-rtos/zephyr/issues/21061

Additional items in the "Triage" column in the GitHub project may be discussed if time permits.
If you want an item included in the meeting, please add it to the GitHub project.

https://github.com/zephyrproject-rtos/zephyr/wiki/Zephyr-Committee-and-Working-Group-Meetings#zephyr-api-discussion
https://github.com/zephyrproject-rtos/zephyr/projects/18
https://docs.google.com/document/d/1lv-8B5QE2m4FjBcvfqAXFIgQfW5oz6306zJ7GIZIWCk/edit

Regards,

Carles


Re: Use different memory bank

Arvid Rosén
 

Great!

 

And yes, those are the old devicetree macros for the same thing. So you can keep the lines I sent as comments in the file until the time you upgrade (but maybe the numbers are different for 1060). Hopefully, we have a better solution for this by then, as the dts_fixup file is deprecated by now.

 

Cheers,

Arvid

 

From: Antoine Zen-Ruffinen <antoine@...>
Date: Monday, 8 June 2020 at 17:14
To: Arvid Rosén <arvid@...>, Henrik Brix Andersen <henrik@...>
Cc: "users@..." <users@...>
Subject: Re: [Zephyr-users] Use different memory bank

 

Thanks Arvid!

 

You solution worked! Thanks! But I had to modify it to work with my code base: 

 

#define ITCM_ADDR (DT_INST_0_NXP_IMX_ITCM_BASE_ADDRESS)

#define DTCM_ADDR (DT_INST_0_NXP_IMX_DTCM_BASE_ADDRESS)

 

I dont know why I had to use a different symbol name than you. Maybe because of Zehpyr version, we use currently 2.2.

 

Best regards,

 

Antoine


From: Arvid Rosén <arvid@...>
Sent: Monday, June 8, 2020 4:27:56 PM
To: Antoine Zen-Ruffinen; Henrik Brix Andersen
Cc: users@...
Subject: Re: [Zephyr-users] Use different memory bank

 

Hi Antoine,

 

We use CODE_DATA_RELOCATION on i.MX RT 1020. It is a bit of a hack though, but I added this to the dts_fixup.h for our board:

 

// Needed for CODE and DATA relocation

#define ITCM_ADDR (DT_N_S_soc_S_flexram_400b0000_S_itcm_0_REG_IDX_0_VAL_ADDRESS)

#define DTCM_ADDR (DT_N_S_soc_S_flexram_400b0000_S_dtcm_20000000_REG_IDX_0_VAL_ADDRESS)

#define OCRAM_ADDR (DT_N_S_soc_S_flexram_400b0000_S_ocram_20200000_REG_IDX_0_VAL_ADDRESS)

 

Obviously, this isn’t a good solution, but it does work for us at least.

 

It would be great with some input on howto solve this for real.

 

Best Regards,

Arvid

 

 

From: <users@...> on behalf of "Antoine Zen-Ruffinen via lists.zephyrproject.org" <antoine=riedonetworks.com@...>
Reply to: "antoine@..." <antoine@...>
Date: Monday, 8 June 2020 at 16:04
To: Henrik Brix Andersen <henrik@...>
Cc: "users@..." <users@...>
Subject: Re: [Zephyr-users] Use different memory bank

 

HI Brix,

 

Yes, I've tried that.  See in my first post:
 

> - How to specify that code should be relocated to ITCM while using CODE_DATA_RELOCATION ? I have tried "zephyr_code_relocate(ram_func.c ITCM)" but with no success.

 

As said, I was able to move come code to the SRAM but not to another RAM bank. Also I'm not sure that the BSP for the i.MXRT is doing it right. There is a few more memory region defined in the linker script in "soc/arm/nxp_imx/rt/linker.ld" and I think it is that that is printed at the end of the compilation. I think the related section are missing in the linker file. I don't know if the build system is expected to generate them from "zephyr_code_relocate() " and place them in the right memory region or if I need to do something extra. Also I like to have the code in ITCM memory (RAM) and data to DTCM memory from the same source file.


From: Henrik Brix Andersen <henrik@...>
Sent: Sunday, June 7, 2020 11:09:01 AM
To: Antoine Zen-Ruffinen
Cc: users@...
Subject: Re: [Zephyr-users] Use different memory bank

 

Hi Antoine,

Have you seen the instructions for code and data relocation in the Zephyr documentation?
https://docs.zephyrproject.org/latest/guides/code-relocation.html

Brix
-- 
Henrik Brix Andersen

> On 4 Jun 2020, at 17.32, Antoine Zen-Ruffinen <antoine@...> wrote:
>
> Hi,
>
> I have trouble getting full usage of the RAM on my SoC using zephyr and I might need a little help as I have not found the needed information in the doc. Here's the situation:
>
> I'm using Zephyr on the iMXRT1062 platform which is an Cortex-M7 with 3 separate non-contigus memory banks, from the datasheet (I's a little more complicated than that, but here I simplify):
>
> ITCM (Instruction Tight Coupled Memory) @ 0x0000'0000, size 128K
> DTCM (Data Tight Coupled Memory) @ 0x2000'0000, size 128K
> OCRAM (General RAM, slower) @ 0x2020'0000, size 768 K
>
> This setup is clearly defined in the .dts and the linker script in `zephyr/soc/arm/nxp_imx/rt/linker.ld`. When compiling an image, I get this same setup printed form the build system too (OCRAM is renamed SRAM by the build system, don't know why):
>
> ....
> [7/12] Linking C executable zephyr/zephyr_prebuilt.elf
> Memory region         Used Size  Region Size  %age Used
>             DTCM:          0 GB       128 KB      0.00%
>             ITCM:          0 GB       128 KB      0.00%
>            FLASH:      276524 B        16 MB      1.65%
>             SRAM:      114196 B       768 KB     14.52%
>         IDT_LIST:         344 B         2 KB     16.80%
> [12/12] Linking C executable zephyr/zephyr.elf
>
> As you can see all is placed in SRAM section. I can change and have everything linked to DTCM using KConfig option "CONFIG_DATA_DTCM", but then it's EVERTHING there . I've discovered that there is a macro `__dtcm_data_section` defined in `zephyr/include/linker/section_tags.h` that I thought it will place the variable in DTCM, but if I use it, I got the following error from the linker:
>
> /home/antoine/tools/SDKs/zephyr-sdk-0.11.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/9.2.0/../../../../arm-zephyr-eabi/bin/ld: warning: orphan section `.dtcm_data' from `app/libapp.a(com_uart.c.obj)' being placed in section `.dtcm_data'
>
> My questions:
>
>  - How to use different non-contigus  memory region with Zephyr ?
>  - How can I specify what data should be placed on witch RAM bank ?
>  - How to specify that code should be relocated to ITCM while using CODE_DATA_RELOCATION ? I have tried "zephyr_code_relocate(ram_func.c ITCM)" but with no success.
>  - Can I place, for instance, all kernel code into ITCM with similar mechanism as "zephyr_code_relocate()" (ITCM  is faster than flash as the flash is external on this SoC)?
>
>
>
> Antoine Zen-Ruffinen
>
> Riedo Networks Ltd
> Route de la Fonderie 6, 1700 Fribourg, Switzerland
> Tel: +41 26 505 50 03, Fax: +41 26 505 50 01 www.riedonetworks.com
>


Re: Use different memory bank

Antoine Zen-Ruffinen
 

Thanks Arvid!


You solution worked! Thanks! But I had to modify it to work with my code base: 


#define ITCM_ADDR (DT_INST_0_NXP_IMX_ITCM_BASE_ADDRESS)
#define DTCM_ADDR (DT_INST_0_NXP_IMX_DTCM_BASE_ADDRESS)

I dont know why I had to use a different symbol name than you. Maybe because of Zehpyr version, we use currently 2.2.


Best regards,


Antoine


From: Arvid Rosén <arvid@...>
Sent: Monday, June 8, 2020 4:27:56 PM
To: Antoine Zen-Ruffinen; Henrik Brix Andersen
Cc: users@...
Subject: Re: [Zephyr-users] Use different memory bank
 

Hi Antoine,

 

We use CODE_DATA_RELOCATION on i.MX RT 1020. It is a bit of a hack though, but I added this to the dts_fixup.h for our board:

 

// Needed for CODE and DATA relocation

#define ITCM_ADDR (DT_N_S_soc_S_flexram_400b0000_S_itcm_0_REG_IDX_0_VAL_ADDRESS)

#define DTCM_ADDR (DT_N_S_soc_S_flexram_400b0000_S_dtcm_20000000_REG_IDX_0_VAL_ADDRESS)

#define OCRAM_ADDR (DT_N_S_soc_S_flexram_400b0000_S_ocram_20200000_REG_IDX_0_VAL_ADDRESS)

 

Obviously, this isn’t a good solution, but it does work for us at least.

 

It would be great with some input on howto solve this for real.

 

Best Regards,

Arvid

 

 

From: <users@...> on behalf of "Antoine Zen-Ruffinen via lists.zephyrproject.org" <antoine=riedonetworks.com@...>
Reply to: "antoine@..." <antoine@...>
Date: Monday, 8 June 2020 at 16:04
To: Henrik Brix Andersen <henrik@...>
Cc: "users@..." <users@...>
Subject: Re: [Zephyr-users] Use different memory bank

 

HI Brix,

 

Yes, I've tried that.  See in my first post:
 

> - How to specify that code should be relocated to ITCM while using CODE_DATA_RELOCATION ? I have tried "zephyr_code_relocate(ram_func.c ITCM)" but with no success.

 

As said, I was able to move come code to the SRAM but not to another RAM bank. Also I'm not sure that the BSP for the i.MXRT is doing it right. There is a few more memory region defined in the linker script in "soc/arm/nxp_imx/rt/linker.ld" and I think it is that that is printed at the end of the compilation. I think the related section are missing in the linker file. I don't know if the build system is expected to generate them from "zephyr_code_relocate() " and place them in the right memory region or if I need to do something extra. Also I like to have the code in ITCM memory (RAM) and data to DTCM memory from the same source file.


From: Henrik Brix Andersen <henrik@...>
Sent: Sunday, June 7, 2020 11:09:01 AM
To: Antoine Zen-Ruffinen
Cc: users@...
Subject: Re: [Zephyr-users] Use different memory bank

 

Hi Antoine,

Have you seen the instructions for code and data relocation in the Zephyr documentation?
https://docs.zephyrproject.org/latest/guides/code-relocation.html

Brix
-- 
Henrik Brix Andersen

> On 4 Jun 2020, at 17.32, Antoine Zen-Ruffinen <antoine@...> wrote:
>
> Hi,
>
> I have trouble getting full usage of the RAM on my SoC using zephyr and I might need a little help as I have not found the needed information in the doc. Here's the situation:
>
> I'm using Zephyr on the iMXRT1062 platform which is an Cortex-M7 with 3 separate non-contigus memory banks, from the datasheet (I's a little more complicated than that, but here I simplify):
>
> ITCM (Instruction Tight Coupled Memory) @ 0x0000'0000, size 128K
> DTCM (Data Tight Coupled Memory) @ 0x2000'0000, size 128K
> OCRAM (General RAM, slower) @ 0x2020'0000, size 768 K
>
> This setup is clearly defined in the .dts and the linker script in `zephyr/soc/arm/nxp_imx/rt/linker.ld`. When compiling an image, I get this same setup printed form the build system too (OCRAM is renamed SRAM by the build system, don't know why):
>
> ....
> [7/12] Linking C executable zephyr/zephyr_prebuilt.elf
> Memory region         Used Size  Region Size  %age Used
>             DTCM:          0 GB       128 KB      0.00%
>             ITCM:          0 GB       128 KB      0.00%
>            FLASH:      276524 B        16 MB      1.65%
>             SRAM:      114196 B       768 KB     14.52%
>         IDT_LIST:         344 B         2 KB     16.80%
> [12/12] Linking C executable zephyr/zephyr.elf
>
> As you can see all is placed in SRAM section. I can change and have everything linked to DTCM using KConfig option "CONFIG_DATA_DTCM", but then it's EVERTHING there . I've discovered that there is a macro `__dtcm_data_section` defined in `zephyr/include/linker/section_tags.h` that I thought it will place the variable in DTCM, but if I use it, I got the following error from the linker:
>
> /home/antoine/tools/SDKs/zephyr-sdk-0.11.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/9.2.0/../../../../arm-zephyr-eabi/bin/ld: warning: orphan section `.dtcm_data' from `app/libapp.a(com_uart.c.obj)' being placed in section `.dtcm_data'
>
> My questions:
>
>  - How to use different non-contigus  memory region with Zephyr ?
>  - How can I specify what data should be placed on witch RAM bank ?
>  - How to specify that code should be relocated to ITCM while using CODE_DATA_RELOCATION ? I have tried "zephyr_code_relocate(ram_func.c ITCM)" but with no success.
>  - Can I place, for instance, all kernel code into ITCM with similar mechanism as "zephyr_code_relocate()" (ITCM  is faster than flash as the flash is external on this SoC)?
>
>
>
> Antoine Zen-Ruffinen
>
> Riedo Networks Ltd
> Route de la Fonderie 6, 1700 Fribourg, Switzerland
> Tel: +41 26 505 50 03, Fax: +41 26 505 50 01 www.riedonetworks.com
>

741 - 760 of 2796