No source available error while executing the PFLash command.

cancel
Showing results for 
Search instead for 
Did you mean: 

No source available error while executing the PFLash command.

716 Views
pratibhasurabhi
Contributor V

Dear Team,

I want to write on the P-Flash of S12ZVML31 MCU.

I have referred the sample code of "ZVL32-FLASH-CW106"

Using same driver function I am trying to write on flash from my Codewarrior project.

I am getting no source available error while executing below function

#pragma CODE_SEG DEFAULT_RAM
void PFLASH_Send_Command(void)
{
asm PSH CCL; // 0x10 command
DisableInterrupts;

FSTAT_CCIF = 1; //launch command
while(FSTAT_CCIF == 0){}; //wait for done

asm PUL CCL; // 0x90 command
}
#pragma CODE_SEG DEFAULT

I have checked the map file of my project, in that PFLASH_Send_Command function is not coming under ".data". It is coming under UNUSED-OBJECTS SECTION.

I have attached the prm and map file.

Please guide me to resolve this issue.

Thank you in advance.

0 Kudos
3 Replies

710 Views
StanoA
NXP Employee
NXP Employee

Hello Pratibhasurabhi,

The attached files looks good. The code must be executed from RAM as defined by #pragma CODE_SEG DEFAULT_RAM.

It must be properly loaded the FCCOBIX and FCCOB registers with valid addresses of “where to write” and “from which address” take data for write. Please look at Section 22.4 of RM_Rev2.49:

https://www.nxp.com/webapp/Download?colCode=MC9S12ZVLRM

The FCCOB register contains all required information for the Memory Controller to execute required operation e.g. whole FLASH erase, block erase, sector erase, sector program and others. The detail commands description is in Section 22.4.5.3 and later.

Please check the information in the FCCOB register before the flash command will be executed.

I think it can help you to solve the issue.

Best Regards,

Stano.

0 Kudos

703 Views
pratibhasurabhi
Contributor V

Dear StanoA,

Thanks for the reply.

The link provided by you is not working.

I have written the proper values in FCCOB register.

I have attached my project zip, please check it.

my concern is, In map file PFLASH_Send_Command function is not coming under procedures as shown below,

pratibhasurabhi_0-1624606301301.png

 As defined by #pragma CODE_SEG DEFAULT_RAM PFLASH_Send_Command  function should execute from RAM but in map file its not coming.

Please check my code and guide me.

 

0 Kudos

700 Views
StanoA
NXP Employee
NXP Employee

Hello Pratibha Surabhi,

sorry for that link, it is such error on web page, but attached is the RM.

Your code is mix of the two projects – for ZVM128 and for ZVM31. The files in folder structure are mixed too so I think the main issue is the compiler can’t reach the right *.prm file when is working on the ZVM31 project. That’s the reason the PFLASH_Send_Command function is not placed and referenced from RAM even if the code in PFlash.c is right:

#pragma CODE_SEG DEFAULT_RAM

void PFLASH_Send_Command(void)

{

   asm PSH CCL;   // 0x10 command

   DisableInterrupts;

  

   FSTAT_CCIF = 1;           //launch command

   while(FSTAT_CCIF == 0){}; //wait for done

 

   asm PUL CCL; // 0x90 command

}

#pragma CODE_SEG DEFAULT

I want to suggest you to divide both projects – start the new Bareboard project for ZVM31 from scratch with right folder structure and then copy the code (not files) into properly aligned files. It would work because the usage of the memory controller looks good.

I wish you many success in your work.

0 Kudos