[ABANDONED] Where is source code for a complete and working Open Flash Loader?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] Where is source code for a complete and working Open Flash Loader?

    Where is source code for a complete and working Open Flash Loader?

    The Open Flash Loader I'm attempting to complete is for an ARM7TDMI-S core with custom peripherals but I'll take a look at anything people confirm to be working.

    Thanks in advance,

    I attempted to create a minimal/simple "Fake Flash" Open Flash Loader from the provided template(s) but I still get "***** Error: Failed to initialize RAMCode". Debugging the "Fake Flash" (and version for real H/W) work as expected.

    I've learned some things along the way that aren't documented but they don't explain the failure I'm seeing. A couple examples are provided below.

    The release build needs at least level 2 debugging enabled. The debugging information is providing information J-Link uses to find the FlashDevice (and probably the entry points).

    The provided templates compile the Init(), EraseSector(), etc. functions for Thumb mode. Without documentation, I'm not sure if that is required for all ARM processors (capable of executing Thumb instructions).
  • I created a working Open Flash Loader example. I did my work on a Linux system. To minimize the amount of data that I provide. I provide the deltas to the Segger provided template, demo, etc. My Open Flash Loader example programs "FakeFlash". The "FakeFlash" is external memory rather than real non-volatile memory. That allow unlimited testing without wear to real non-volatile memory.

    I found a Segger demo for the Atmel SAMA5D3. I used that Segger provided demo as the application to be programmed into flash because I have the Atmel SAMA5D3 and it will be more familiar (i.e. better supported) to other users (and Segger). I provide a patch file to convert the provided demo to a build for "FakeFlash".

    The URL for the Segger Atmel SAMa5D3 Xplained demo is:

    The sha256sum for the SeggerEval_ATSAMA5D36_Atmel_SAMA5D3_Xplained_ARM_SES_FS_IP_OS_USB_USBH_MB_COMPRESS_180214.zip archive I used is:

    I suggest creating a git repository for the directory contents extracted from the archive above. Then apply the patch provided by the attached 0001-Modify-Segger-Atmel-SAMA5D3-Xplained-demo-for-testin.patch.zip archive. The sha256sum for the attached archive is:

    You can build and run the modified Segger Atmel SAMa5D3 Xplained demo before using the "FakeFlash" Open Flash Loader example. It will just load into upper memory without using the Open Flash Loader example (until you update the JLinkDevices.xml file to add the "FakeFlash" Open Flash Loader example).

    The Segger Cortex-AR Open Flash Loader demo can be downloaded from:

    The sha256sum for the OpenFlashLoader_CortexAR_Template_EmbeddedStudio.zip file I used is:

    Similar to my suggestion for the demo above, I suggest you create a git repository for the unmodified Open Flash Loader template directory.

    Apply the patch contained in the 0001-Convert-Segger-provided-Open-Flash-Loader-template-t.patch.zip archive to the Segger Open Flash Loader template directory. The sha256sum for the archive is:

    After applying the patch to the Open Flash Loader template and building the release build, you will then need to tell your development environment to use the created Open Flash Loader.

    For my Linux system, that required modification of the Segger Embedded Studio for Arm installation hierarchy. First I added the lines immediately below to just before the last line of /usr/share/segger_embedded_studio_for_arm_4.12/bin/JLinkDevices.xml.

    <ChipInfo Vendor="ATMEL" Name="ATSAMA5D33" />
    <FlashBankInfo Name="FakeFlash" BaseAddr="0x2F800000" MaxSize="0x00800000" Loader="Devices/ATMEL/SAMA5D3/Sama5D3_FakeFlash.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="0"/>

    This tells Segger Embedded Studio for Arm that the [0x2F800000-0x2FFFFFFF] range must be programmed via the "Devices/ATMEL/SAMA5D3/Sama5D3_FakeFlash.elf" Open Flash Loader.

    You must also create the "Devices/ATMEL/SAMA5D3" relative path from the JLinkDevices.xml file. Put your Sama5D3_FakeFlash.elf build into the directory you created.

    This build logs Open Flash Loader calls into a memory log buffer @ 0x2f000000. The Notes/OpenFlashLoaderLog.sh script processes a dump of the log buffer. I didn't put much effort into logging and the script so it requires human tweaking each time your change the line numbers associated with the logging points. The log confirms that the following functions are called; Init(), Verify(), UnInit(), EraseSector(), and ProgramPage(). The FindSectorForAddr() function is a helper function I wrote.

    It took me many more hours than I expected to achieve this working example because I didn't notice any mention of important details.