External Memory with J-Tag
Is it possible to program external RAM using CrossStudio and a CrossConnect ?
We have a large project on a LPC2468 and are close to filling the (512k) internal flash. However we have a large amount of external FLASH and external RAM.
We would like to be able to store our program (encrypted) in the external flash and have the bootloader decrypt it and move part of it into the internal FLASH and the remainder (that doesn't fit) into the external RAM.
To be able to develop/program/debug in this situation we would like to have the J-Tag program both the internal FLASH and external RAM.
Is this possible ? and if so how should we go about it ?
-
>To be able to develop/program/debug in this situation we would like to have the J-Tag program both the internal FLASH and external
>RAM.
>
>Is this possible ? and if so how should we go about it ?Yes.
I suggest you take a look at the "external_memory" example in the Olimex LPC-2478-STK board support package which does exactly this.
Download is achieved by having a modified LIBMEM loader that configures external memory and then registers a RAM LIBMEM driver in addition to the regular driver for the internal FLASH.
The section placement file has been modified to place sections named .bss2 and .data2 in external RAM.
-
Thanks for the pointer Jon, I have a LIBMEM loader working now, however I have a further issue.
With my current setup, the external memory is configured and loaded fine. However when I reset the target with the debugger the Uc is reset therefore the external memory interface becomes un-configured, and the LIBMEM loader does not reconfigure it and reload the external memory, which is currently required at the start of the application. (ie the J-TAG configures and loads it in development environment and boot loader configures and loads it in production environment )
Is there any way to set this up? ie have the debugger re-init the external memory controller and re-load the data into this memory after clicking the restart button in the debug environment?
PS. The Olimex LPC-2478-STK example does not seem to load external memory with the J-TAG (it seems to copy the data from flash in the startup code), and the LIBMEM loader code does not seem to work properly (because it fails to configure the external memory controller). But it gave me enough information to work it out.
-
Looks like I had a cut and paste issue with the above, here is a re-post (hopefully it works better):
Thanks for the pointer Jon, I have a LIBMEM loader working now, however I have a further issue.
With my current setup, the external memory is configured and loaded fine. However when I reset the target with the debugger the Uc is reset therefore the external memory interface becomes un-configured, and the LIBMEM loader does not reconfigure it and reload the external memory, which is currently required at the start of the application. (ie the J-TAG configures and loads it in development environment and boot loader configures and loads it in production environment )
Is there any way to set this up? ie have the debugger re-init the external memory controller and re-load the data into this memory after clicking the restart button in the debug environment?
PS. The Olimex LPC-2478-STK example does not seem to load external memory with the J-TAG (it seems to copy the data from flash in the startup code), and the LIBMEM loader code does not seem to work properly (because it fails to configure the external memory controller). But it gave me enough information to work it out.
-
>Is there any way to set this up? ie have the debugger re-init the external memory controller and re-load the data into this memory after
>clicking the restart button in the debug environment?To get the debugger to configure the external memory each time you reset you'll need to modify the reset script and get it to configure the memory as required after the reset has been carried out.
Alternatively, you could get the program to configure the external memory - from what you describe it sounds like you already have a boot loader which does this job. In which case, perhaps a better solution would be to change the "Linker Options > Entry Point" project property of the application so that the entry point is that of the bootloader. If you do this, the boot loader will always run prior to the application when debugging making it much more like the final production environment.
Please sign in to leave a comment.
Comments
4 comments