I want to store the variables of my code in the External SDRAM,So I've made these change to Target tab of Options window :
1. Default box for off-chip RAM1 is checked (Base Address: 0xA0000000 Size:0x10000000 2. Default box for on-chip IRAM1 is unchecked (both with unchecked No Init checkbox)
Also, I’ve edited the startup_LPC177x_8x in this order:
Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT SDRAMInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =SDRAMInit BLX R0 LDR R0, =__main BLX R0 ENDP
But when I debug, as you can see in picture above, program line stops at ‘SystemInit’ line Please notice that when Internal Memory is selected as default, there is no problem with accessing to Ext SDRAM in main.c code and it’s possible to read & write from SDRAM correctly. (for example, I checked the address 0xA0000001)
I want my MCU to be Initialized with Ext SDRAM or at best with both of them (Internal & External) but it’s not possible yet. Do I have to change the SystemInit config? How can I solve this issue?
Thanks In Advance
Sorry not seeing a picture or link to one. Code related to the screen shot is also not provided.
Normally you'd initialize external memory and buses in SystemInit() or functions called by it. You must remember however that at this point no statics have or can be initialized, so your C code needs to very simple and not rely on RAM initialized variables.
If it is fouling up in SystemInit() it suggests it is expecting something you haven't supplied, DEBUG IT
Westonsupermare, Sorry for the image. Please refer to the reply I've posted for Westermark. I debugged my code and as I said it stops at this line in startup_LPC177x_8x.s :
LDR R0, =SystemInit
and also I can't proceed to debug because the buttons for accessing the inside of function is not active when debugging stops at that line. I don't know whgat is the problem with that line.
Thank you
You should be able step, and step-in from the disassembly view.
If you can't perhaps you'd want to disassemble the app fully and walk the code manually.
I would not replace IRAM, it works without any initialization, I'd put the heap into the SDRAM and allocate it from there, or use a scatter file and assembler directives or pragmas to direct specific static allocations into it.
Consider wth you are putting the stack!! You can't put the stack in the SDRAM during start-up, it simply isn't working yet, and it is probably SLOWER than IRAM