Usage of CCM RAM in 3.0.0

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Usage of CCM RAM in 3.0.0

Post by Korken »

Hi,

Is it planned to add the CCM RAM in 3.0.0 linker scripts again?
I was using that linker-file with 2.6.4 but it seems to have disappeared in 3.0.0.

Best Regards
Emil
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Usage of CCM RAM in 3.0.0

Post by Giovanni »

The file from 2.6.x can be used with minimal modifications: just remove the stack sizes settings, those symbols come from the makefile now.

Giovanni
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: Usage of CCM RAM in 3.0.0

Post by Korken »

Great news! :) Feels bad to not use the CCM.

I converted a copy of rules.ld to rules_ccm.ld.
If you want you can add it to 3.0.0: https://github.com/korken89/KFly_ChibiO ... les_ccm.ld
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: Usage of CCM RAM in 3.0.0

Post by Korken »

I have been trying out the CCM linker a bit, but a strange side effect appears.
If you put any variable in CCM memory using __attribute__ ((section(".ccm"))) the generated .bin file is huge, about 130MB.
The problem is that the linker includes all data from flash to the CCM memory in the .bin fiile.
To make this not happen I needed to change the ".ccm : " line in rules_ccm.ld to ".ccm (NOLOAD) : "
Could be worth knowing. :)
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: Usage of CCM RAM in 3.0.0

Post by Korken »

While still talking about CCM RAM, I have another question.

Does any of the abstract stream or abstract channel interfaces (chSequentialStreamXXX / chnXXX) any problem with reading from the CCM RAM?
I was unable to find in the documentation if any one of these rely on the DMA for transferring data.

I'm thinking of putting some data buffers in the CCM RAM but I am unsure if it would cause problems when at a later time transmitting this data over UART, SPI or USB.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Usage of CCM RAM in 3.0.0

Post by Giovanni »

It causes problems only with those drivers using DMA: ADC, SPI, I2C, I2S, UART and soon DAC.

Streams by themselves are just interfaces so the answers is: it depends on the implementing class/driver.

Giovanni
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: Usage of CCM RAM in 3.0.0

Post by Korken »

Okey!

I looked into the code of the STM32 UART driver and I think I understand.
For example the Serial driver seems to use interrupt driven transfers while the "UART" driver uses DMA directly to transfer data.

Thanks for the clarification! :)
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: Usage of CCM RAM in 3.0.0

Post by russian »

Korken wrote:I have been trying out the CCM linker a bit, but a strange side effect appears.
If you put any variable in CCM memory using __attribute__ ((section(".ccm"))) the generated .bin file is huge, about 130MB.
The problem is that the linker includes all data from flash to the CCM memory in the .bin fiile.
To make this not happen I needed to change the ".ccm : " line in rules_ccm.ld to ".ccm (NOLOAD) : "
Could be worth knowing. :)

We've got the same issue - 130MB .bin file with default Chibi CCM .ld file

Once we've added (NOLOAD) the .bin got to the normal 160Kb size. This is important because linux guys need to have a .bin file for their non-official https://github.com/texane/stlink flasher. Once my guy confirms that this has resolved the linux flashing problem, I will create a ticket to fix the default CCM .ld file because I guess it's worth fixing.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Usage of CCM RAM in 3.0.0

Post by Giovanni »

Please do.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: Usage of CCM RAM in 3.0.0

Post by russian »

Yep, the NOLOAD did fix the problem for my linux guy! https://sourceforge.net/p/chibios/bugs/507/
Post Reply