Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing flash operations with gcc -O3 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions drivers/source/cy_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ cy_en_flashdrv_status_t Cy_Flash_WriteRow(uint32_t rowAddr, const uint32_t* data
CPUSS_SYSARG = (uint32_t) &parameters[0U];
CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_LOAD;
__NOP();
__NOP();

result = ProcessStatusCode();
if(CY_FLASH_DRV_SUCCESS == result)
Expand Down Expand Up @@ -198,6 +199,7 @@ cy_en_flashdrv_status_t Cy_Flash_WriteRow(uint32_t rowAddr, const uint32_t* data
CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_WRITE_ROW;
}
__NOP();
__NOP();

result = ProcessStatusCode();
resultClockRestore = Cy_Flash_ClockRestore();
Expand Down Expand Up @@ -300,6 +302,7 @@ cy_en_flashdrv_status_t Cy_Flash_StartWrite(uint32_t rowAddr, const uint32_t* da
CPUSS_SYSARG = (uint32_t) &parameters[0U];
CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_LOAD;
__NOP();
__NOP();
result = ProcessStatusCode();

if(result == CY_FLASH_DRV_SUCCESS)
Expand Down Expand Up @@ -329,6 +332,7 @@ cy_en_flashdrv_status_t Cy_Flash_StartWrite(uint32_t rowAddr, const uint32_t* da
CPUSS_SYSARG = (uint32_t) &parameters[0U];
CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_NON_BLOCKING_WRITE_ROW;
__NOP();
__NOP();
result = ProcessStatusCode();
}

Expand Down Expand Up @@ -373,6 +377,7 @@ cy_en_flashdrv_status_t Cy_Flash_ResumeWrite(void)
CPUSS_SYSARG = (uint32_t) &parameters[0U];
CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_RESUME_NON_BLOCKING;

__NOP();
__NOP();
result = ProcessStatusCode();

Expand Down Expand Up @@ -483,6 +488,7 @@ cy_en_flashdrv_status_t Cy_Flash_RowChecksum(uint32_t rowAddr, uint32_t* checksu
CPUSS_SYSARG = (uint32_t) parameters[0U];
CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_CHECKSUM;
__NOP();
__NOP();
result = ProcessStatusCode();
if (CY_FLASH_DRV_SUCCESS == result)
{
Expand Down Expand Up @@ -663,6 +669,7 @@ static cy_en_flashdrv_status_t Cy_Flash_ClockBackup(void)
CPUSS_SYSARG = (uint32_t) &parameters[0U];
CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_CLK_BACKUP;
__NOP();
__NOP();
result = ProcessStatusCode();

/* Enabling IMO after backup completion as required by hardware.
Expand Down Expand Up @@ -692,6 +699,7 @@ static cy_en_flashdrv_status_t Cy_Flash_ClockConfig(void)
CY_FLASH_KEY_ONE);
CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_CLK_CONFIG;
__NOP();
__NOP();
result = ProcessStatusCode();

return (result);
Expand Down Expand Up @@ -720,6 +728,7 @@ static cy_en_flashdrv_status_t Cy_Flash_ClockRestore(void)
CPUSS_SYSARG = (uint32_t) &parameters[0U];
CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_CLK_RESTORE;

__NOP();
__NOP();
result = ProcessStatusCode();

Expand Down