[TALK] Problems with Cortex-M7

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [TALK] Problems with Cortex-M7

Postby Giovanni » Thu Aug 27, 2015 10:14 am

I added an article explaining what we discussed here: http://chibios.org/dokuwiki/doku.php?id ... _dma_guide

Giovanni

User avatar
alex31
Posts: 379
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 62 times
Contact:

Re: [TALK] Problems with Cortex-M7

Postby alex31 » Sun Aug 30, 2015 9:05 am

Code: Select all

  for (i = 0; i < SPI_BUFFERS_SIZE; i++)
    txbuf[i] = (uint8_t)i;
  dmaBufferFlush(txbuf, SPI_BUFFERS_SIZE);
 
  /* Slave selection and data exchange.*/
  spiSelect(&SPID2);
  spiExchange(&SPID2, SPI_BUFFERS_SIZE, txbuf, rxbuf);
  spiUnselect(&SPID2);
 
  /* Invalidating cache over the buffer then checking the
     loopback result.*/
  dmaBufferInvalidate(rxbuf, SPI_BUFFERS_SIZE);


Would it be possible to have some define in mcuconf.h, like SPI2_USE_DMA_VALIDATION (you see the meaning) so that
dmaBufferFlush is called before doing the spiExchange and spiWrite, and dmaBufferInvalidate is called after spiExchange and spiRead
in the driver, so that would transparent to the user ?

there would only be the 32 bytes alignment that should be explicitly done by the programmer, and that alignment could be checked at runtime
in case of the SPI2_USE_DMA_VALIDATION macro is set when check is done, raising an abort if alignment is not respected (and the bug will be found/fix quickly)

otherwise, i know that i will do for myself a function helper that will do that for me because sometime i will forget a flush or an invalidate,
leading to hours of stupid debugging (yes, i begin to know me ...)

Alexandre --

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [TALK] Problems with Cortex-M7

Postby Giovanni » Sun Aug 30, 2015 12:18 pm

That was the initial idea but buffers must be aligned so it is not possible to make it entirely transparent to the user.

Giovanni

User avatar
alex31
Posts: 379
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 62 times
Contact:

Re: [TALK] Problems with Cortex-M7

Postby alex31 » Sun Aug 30, 2015 4:06 pm

Of course buffer(s) has to be declared with this 32 bytes alignment, but the calls to the api are transparent, and if the programmer forgot to align the buffers, you can easily test that the buffers addresses are correctly aligned, and if not, abort (when CH_DBG_ENABLE_ASSERTS is set). Furthermore, the dma functions will be called errorless.

In the no_transparent way, the user has the burden to call the dma flush api, nothing will detect if it's not done correctly and nothing will detect if the buffer(s) is(are) not aligned.

Have pity of a poor teacher who must supervise practical work sessions with generation Y students :-))

Alexandre

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [TALK] Problems with Cortex-M7

Postby Giovanni » Sun Aug 30, 2015 4:16 pm

I would avoid the F7 for students, everything else is almost equal to the F4 with some extra performance on top.

Giovanni

User avatar
alex31
Posts: 379
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 62 times
Contact:

Re: [TALK] Problems with Cortex-M7

Postby alex31 » Sun Aug 30, 2015 6:26 pm

Well, for now we stay on F4, but for some complicated kind of kalman filter, IKF and IUKF, the extra performance
of the F7 would be welcome. In fact, we will wait a little bit more when stmicro will put 64 bits FPU in the F7 line, because
more than raw power, we need double float FPU to improve numerical stability of some class filters which tend to diverge easily.

That will leave you time to reconsider providing a dumbproof api for programmers with head in the clouds like me :-)

Alexandre

User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Location: Minsk, Belarus
Been thanked: 7 times

Re: [TALK] Problems with Cortex-M7

Postby barthess » Mon Aug 31, 2015 4:27 pm

alex31 wrote:In fact, we will wait a little bit more when stmicro will put 64 bits FPU in the F7 line

Are such MCUs already announced?

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [TALK] Problems with Cortex-M7

Postby Giovanni » Mon Aug 31, 2015 7:14 pm

barthess wrote:
alex31 wrote:In fact, we will wait a little bit more when stmicro will put 64 bits FPU in the F7 line

Are such MCUs already announced?


Not yet but I think that the F7 is a device just meant to be a direct upgrade for the F4 (it is almost equal except the core). I would be surprised if they are not working on something much more poweful.

Giovanni

User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Location: Minsk, Belarus
Been thanked: 7 times

Re: [TALK] Problems with Cortex-M7

Postby barthess » Wed Sep 02, 2015 1:39 pm

Meh... this F7 looks like draft series. Needs strange works around caches, DMA, ART. Has single precision FPU instead of double. Etc...

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [TALK] Problems with Cortex-M7

Postby Giovanni » Wed Sep 02, 2015 1:59 pm

The cache handling thing is not specific of the F7, apparently it is not handled by the ARM core.

It is strange that they didn't leverage the double precision FPU. The only reason I can think of are erratas in the early M7.

Giovanni


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 61 guests