Welcome to OGeek Q&A 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...