Write into flash


BF706 series with w25q32bv

To write a .ldr file into a flash, I am using below command.

 cldp -proc ADSP-BF706 -emu 1000 -driver "C:\Analog Devices\ADSP-BF706_EZ-KIT_Mini-Rel1.1.0\BF706_EZ-Kit_MINI\Blackfin\Examples\Device_programmer\bf706_w25q32bv_dpia.dxe" -cmd prog -erase all -offset 0 -format hex -file "C:\Users\Test\Debug\Test.ldr"

The .ldr will be write into flash at adresse 0x40000000 (SPI2 memory) 

My question is, what if I want to use Write_flash_page() function to write a .ldr file to flash at the addresse 0x40001000. The Write_flash_page() function is:

void Write_flash_page(unsigned int PAGE_ADDR, unsigned char* flash_page_data_buff, unsigned short page_data_count)
*pREG_SPI2_SLVSEL &= ~ENUM_SPI_SLVSEL_SSEL1_HI ; // selct_flash;
flash_byte_access(FLASH_WR_EN); // send write enable command
*pREG_SPI2_SLVSEL |= ENUM_SPI_SLVSEL_SSEL1_HI ; // deselct_flash;
wait_for_flash_status(WEL, 1);

*pREG_SPI2_SLVSEL &= ~ENUM_SPI_SLVSEL_SSEL1_HI ; // selct_flash;
flash_byte_access(FLASH_PG_PRM); // send page program command
flash_byte_access(PAGE_ADDR >> 16);
flash_byte_access(PAGE_ADDR >> 8);

int i;
for(i=0; i<page_data_count; i++)

*pREG_SPI2_SLVSEL |= ENUM_SPI_SLVSEL_SSEL1_HI ; // deselct_flash;

wait_for_flash_status(WIP, 0);

Can I just call the above function like this:

Write_flash_page(0x40000000, unsigned char* flash_page_data_buff, unsigned short page_data_count);

Anyone can please help me.