Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: XIP from external memory on 4.1?

  1. #1
    Junior Member
    Join Date
    Sep 2019
    Location
    United States
    Posts
    18

    XIP from external memory on 4.1?

    Hi,
    I'm considering what I guess would be a non-standard memory map; but it depends on
    the ability to run XIP from the add-on memory (PSRAM &| FLASH) on the Teesny4.1.
    I see that they are hooked up to the FlexSPI interface on the chip, and the 1060 does support
    XIP from FlexSPI, so is there any reason why I wouldn't be able to run XIP (execute in place)
    from either of those devices?

    As a follow-on question (assuming I can run XIP from those external devices); does the HalfKay
    bootloader support writing to the external Flash memory space?
    Thanks,

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,079
    Quote Originally Posted by edsut View Post
    so is there any reason why I wouldn't be able to run XIP (execute in place)
    from either of those devices?
    Yes, the MPU would be 1 reason...

    By default the memory ranges not normally used for code are configured with NOEXEC. It's meant as a security precaution. So you would need to edit this code in startup.c:

    Code:
            SCB_MPU_RBAR = 0x70000000 | REGION(i++); // FlexSPI2
            SCB_MPU_RASR = MEM_CACHE_WBWA | READONLY | NOEXEC | SIZE_256M;
    
            SCB_MPU_RBAR = 0x70000000 | REGION(i++); // FlexSPI2
            SCB_MPU_RASR = MEM_CACHE_WBWA | READWRITE | NOEXEC | SIZE_16M;
    If you delete NOEXEC, then it should become possible to execute code from those memory ranges.


    does the HalfKay bootloader support writing to the external Flash memory space?
    No, definitely not. You will need to arrange for putting the code into that memory. The bootloader only knows how to write to the main flash memory. The bootloader also does not erase that memory, so each time you wish to change that code, you'll need to erase it before writing new data. But the good news is once you've build special code and gone though the trouble to write it there, it will remain intact in that extra flash memory chip as you do normal loading of the main flash memory.

    You also need the linker to create code meant to execute from the address where you will place it. The compiler can do that, but at the very least you will need to create a special linker script.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •