Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

embedded - Contiki-NG CC2538 rom_util_program_flash problem

I am writing a service of Contiki os, that is supposed to run on a CC2538. However, I encounter a problem that I am not aware of why happens. More specifically, I want to write to consecutive pages of flash a given array (my_arr). However, after the 20th iteration, the program stops and the board reboots. Do you know why this happens? I have also encountered a similar problem with the erase function.

int8_t* my_arr= (int8_t*)malloc(2048);

for(int i=0; i<2048; i++)
    my_arr[i] = i+1;


int8_t* init_addr = (int8_t*)0x222000;

for(int i=0;i<40;i++){

     rom_util_program_flash((uint32_t *)my_arr,
           (uint32_t)(init_addr +i*2048),
           2048);

           LOG_INFO("%d
",i);
}
question from:https://stackoverflow.com/questions/65944129/contiki-ng-cc2538-rom-util-program-flash-problem

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The reboots are caused by the watchdog.

Try adding a watchdog_periodic() before each write to avoid the reboots.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...