Program download

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Program download

1,366 Views
yoshiakisuzuki
Contributor I

I am developing LPC 4370 using LPCXplessov 8.2.2.
I want to transfer the M4 program stored in the SPIF FLASH ROM to internal RAM, but I do not know how to do it.
How do I set it up?

0 Kudos
7 Replies

862 Views
yoshiakisuzuki
Contributor I

The problem was solved by the following procedure.
① Prepare the memory for the vector table. (M4_vector is assumed)
② Execute the build.
③ When the build is completed normally, change the "M4_Debug.ld" file partially.
    
/ * DATA section for M4_vector * /
      
.data_RAM2: ALIGN (4)
    
{
        
FILL (0xff)
        
PROVIDE (__start_data_RAM 2 =.);
        
* (. ramfunc. $ RAM 2)
        
* (. ramfunc. $ M 4 _vector)
        
* (. data. $ RAM 2 *)
        
* (. data. $ M4 _vector *)
        
. = ALIGN (4);
        
PROVIDE (__end_data_RAM 2 =.);
         
KEEP (* (. M4 _ vector)) / * ----------------- Add this line ------------- * /
     
}> M 4 _vector AT> SPIFI_FLASH
④ Uncheck Manage linker script in Properties.
⑤ Create a vector table before main ().
//////////////////////////////////////////////////////////////////////////////////////
// Vector table to be expanded in RAM
#define WEAK __attribute__ ((weak))
extern void _ vStackTop (void);
WEAK extern void __valid_user_code_checksum ();

extern void (* const ram _ Vectors []) (void);
__attribute__ ((section (". M4 _ vector"))))
void (* const ram _ Vectors []) (void) = {
    
// Core Level - CM 4
    
& _ vStackTop, // The initial stack pointer
    
ResetISR, / / The reset intr
    
NMI_intr, // The NMI intr
    
HardFault_intr, / / The hard fault intr
    
MemManage_intr, / / The MPU fault intr
    
BusFault_intr, / / The bus fault intr
    
UsageFault_intr, // The usage fault intr
    
__valid_user_code_checksum, // LPC MCU Checksum
:
:
:
⑥ For interrupt processing other than "ResetISR", create a new one for your own vector table.

0 Kudos

862 Views
yoshiakisuzuki
Contributor I

Thanks for your answer.
I have carried out the third plan.
According to "14.11.1 Relocating code from FLASH to RAM", the program excluding "cr_startup_lpc 43xx.c" was transferred to RAM.
But I also want to transfer vector table and interrupt handling to RAM, but is there any way?
(No access is made to SPIFI FLASH after transfer from SPIFI FLASH to RAM)

0 Kudos

862 Views
lpcxpresso_supp
NXP Employee
NXP Employee

There are a couple of ways that you might approach this on the LPC4370...

First of all, if you develop and debug your application as an RAM image (avoiding the use of the SPIFI flash completely), you can then, at the final stages of development, wrap a binary version of the image with a header - which allows it to be programmed into SPIFI flash - but which the ROM bootloader of the chip will then automatically relocate to RAM at reset. This wrapping can be done using the "image_manger" utility provided as part of LPCScrypt (http://www.nxp.com/lpcscrypt).  For more background information on this, see the section on "Boot process for parts without flash" in the LPC43xx User Manual.

Alternatively, you can build your image such that it contains code that will copy some (or even all) of the code from SPIFI flash into RAM as part of its initialisation routine. A starting point for information on how to approach this can be found for LPCXpresso IDE at:https://community.nxp.com/thread/389110 

Or better still, I would recommend switching to the replacement MCUXpresso IDE product, and look at the MCUXpresso IDE v10.1 User Guide, chapter 14, "Memory Configuration and Linker Scripts". For more information on MCUXpresso IDE, visit : http://www.nxp.com/mcuxpresso/ide

Regards,

MCUXpresso IDE Support

0 Kudos

862 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Yoshiaki Suzuki,

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.
To provide the fastest possible support I want to point you to a 
similar question which has been answered on our NXP community. 
to view the details.
Have a great day,

TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

862 Views
yoshiakisuzuki
Contributor I

Thank you for your answer.
However, the problem was not solved.

0 Kudos

862 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Yoshiaki Suzuki,

Thanks for your reply.

You should copy the code from the Flash to RAM via a defined function which is located at specific address in the RAM before remapping code.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

862 Views
yoshiakisuzuki
Contributor I

Thank you for your answer.
How do I make settings for that?

0 Kudos