MPC 5748G Start up code

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

MPC 5748G Start up code

Jump to solution
444 Views
Mustafa123
Contributor I

Good afternoon , please i used MPC5748G development board and i have two questions 

 

 1- can please there is a complete example for start up code 

 2- i study now the startup code from examples 

===========================================================================

void memory_config_160mhz(void) {
uint32_t mem_write_code_vle [] = {
      0x54640000, /* e_stw r3,(0)r4 instr.: writes r3 contents to addr in r4 */
      0x7C0006AC, /* mbar instruction: ensure prior store completed */
      0x00040004 /* 2 se_blr's instr.: branches to return address in link reg */
};
/* Structures are default aligned on a boundary which is a multiple of */
/* the largest sized element, 4 bytes in this case. The first two */
/* instructions are 4 bytes, so the last instruction is duplicated to */
/* avoid the compiler adding padding of 2 bytes before the instruction.*/

    typedef void (*mem_write_code_ptr_t)(uint32_t, uint32_t);
                 /* create a new type def: a func pointer called mem_write_code_ptr_t */
                 /* which does not return a value (void) */
                /* and will pass two 32 bit unsigned integer values */
               /* (per EABI, the first parameter will be in r3, the second r4) */
                             asm (" mbar"); /* Wait for prior code to complete before proceeding. */

=========================================================================

can please can i know 

    0x54640000, /* e_stw r3,(0)r4 instr.: writes r3 contents to addr in r4 */
      0x7C0006AC, /* mbar instruction: ensure prior store completed */
      0x00040004 /* 2 se_blr's instr.: branches to return address in link reg */

 

why these values  i will be thankful

 

again thank you very much for time and help

0 Kudos
1 Solution
427 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

unfortunately we do not have separate example of startup files, you can take a look at the project examples as you mentioned.

There are usually some restrictions when accessing platform flash registers. This note is copied from MPC5748G reference manual:

lukaszadrapa_0-1668426746345.png

So, startup codes usually write all platform flash registers from RAM memory.

To make is very simple, this trick is usually used: small initialized array/variable is created in RAM memory. Initialization data represents opcode of very simple function which loads configuration to the registers. Then pointer to function is used to call this "function".

If you are interested what these instructions do exactly, take a look at:

https://www.nxp.com/docs/en/reference-manual/VLEPEM.pdf

Regards,

Lukas

View solution in original post

0 Kudos
1 Reply
428 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

unfortunately we do not have separate example of startup files, you can take a look at the project examples as you mentioned.

There are usually some restrictions when accessing platform flash registers. This note is copied from MPC5748G reference manual:

lukaszadrapa_0-1668426746345.png

So, startup codes usually write all platform flash registers from RAM memory.

To make is very simple, this trick is usually used: small initialized array/variable is created in RAM memory. Initialization data represents opcode of very simple function which loads configuration to the registers. Then pointer to function is used to call this "function".

If you are interested what these instructions do exactly, take a look at:

https://www.nxp.com/docs/en/reference-manual/VLEPEM.pdf

Regards,

Lukas

0 Kudos