On Mon, Jun 7, 2021 at 12:24 PM Tim <t...@jti.uk.com.invalid> wrote: > > This is probably not really a NuttX question per se, but it relates to > getting the MCAN interface for a sama5d2 to work properly. And you are all > such knowledgable and helpful people :) > > > > The MCAN controllers assume the base address of the message ram is at > 0x200000+offsets. 0x200000 is the internal SRAM whereas everything else is > in DDR from 0x2000000. I will readily confess that this side of programming > is my very weakest!! > > > > I will, I believe, need to declare - place - MCAN related structures such > that they (or at least some elements of them) are in SRAM. > > > > Is that possible? "CONFIG_MM_REGIONS" related maybe?
Yes. It is possible. It is done by adding attributes in the code which tell the compiler that an object should be located at a particular address or section. If in a section, then the section needs to be declared in the linker script. See the docstring of gran_initialize() in mm/mm_gran/mm_graninit.c for an explanation. This StackOverflow question (and answers) might be helpful: https://stackoverflow.com/questions/18347122/attribute-sectionname-usage Be mindful of making sure that nothing will overlap the same area of memory. For an example where I ran into that kind of gotcha: https://github.com/apache/incubator-nuttx/pull/3198 and the discussion linked from there: https://lists.apache.org/thread.html/recf2bb9043f8c9f53c10917e2adb2ec64fe35dc5e6f9a695a7ac6ecc%40%3Cdev.nuttx.apache.org%3E Don't know whether you need to be concerned with CONFIG_MM_REGIONS or not. Hope this helps! Nathan