Skip to content

Commit c3c7704

Browse files
authored
Add OTA feature (Ameba-AIoT#256)
* Add OTA feature * Update prebuild and postbuild minor errors * update tools 1.3.7
1 parent e98a1d0 commit c3c7704

File tree

23 files changed

+282
-10
lines changed

23 files changed

+282
-10
lines changed

Ameba_misc/Ameba_tools/postbuild_tool/postbuild.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ string isp_file_name_buf[100];
3838
string nn_model_yolotiny_name, nn_model_srcfd_name, nn_model_mobilefacenet_name, nn_model_yamnet_name, nn_model_imgclass_name, nn_header_name1, nn_header_name2, nn_header_name3, nn_header_name4, nn_header_name5, isp_bin_check_name, ota_mode_check_name, fcs_mode_check_name;
3939
string ino_name_buf[100];
4040

41+
string partitiontable_json_name, partition_bin_name;
42+
4143
int isp_selection_check = 0;
4244
int nn_model_selection_check = 0;
4345
int ota_mode_selection_check = 0;
@@ -307,7 +309,7 @@ int main(int argc, char *argv[]) {
307309
string string_temp_1 = "cp misc/video_img/";
308310
string string_temp_2 = " ./";
309311
string string_temp_3 = "cp misc/nn_img/";
310-
string string_temp_4 = "cp ";
312+
string string_temp_4 = "cp -r ";
311313
string string_temp_5 = "/*";
312314
string string_temp_6 = "cp image_tool/";
313315
string string_temp_7 = "misc/video_img/";
@@ -580,21 +582,32 @@ int main(int argc, char *argv[]) {
580582
system(cmd.c_str());
581583
}
582584

585+
ota_mode_check_name = argv[8];
586+
ota_mode_check(ota_mode_check_name);
587+
588+
if (ota_mode_selection_check == 1){
589+
partitiontable_json_name = "amebapro2_partitiontable_OTA.json";
590+
partition_bin_name = "partition_ota.bin";
591+
} else {
592+
partitiontable_json_name = "amebapro2_partitiontable.json";
593+
partition_bin_name = "partition.bin";
594+
}
595+
583596
cmdss.clear();
584-
cmdss << string_temp_1 << "combine amebapro2_partitiontable.json system_files.bin PT_PT=partition.bin,CER_TBL=certable.bin,KEY_CER1=certificate.bin,PT_BL_PRI=boot.bin,PT_FCSDATA=boot_fcs.bin";
597+
cmdss << string_temp_1 << "combine "<< partitiontable_json_name << " system_files.bin PT_PT=" << partition_bin_name << ",CER_TBL=certable.bin,KEY_CER1=certificate.bin,PT_BL_PRI=boot.bin,PT_FCSDATA=boot_fcs.bin";
585598
getline(cmdss, cmd);
586599
cout << cmd << endl;
587600
system(cmd.c_str());
588601

589602
if (nn_model_selection_check == 1) {
590603
cmdss.clear();
591-
cmdss << string_temp_1 << "combine amebapro2_partitiontable.json flash_ntz.bin PT_PT=partition.bin,CER_TBL=certable.bin,KEY_CER1=certificate.bin,PT_BL_PRI=boot.bin,PT_FW1=firmware.bin,PT_NN_MDL=nn_model.bin,PT_ISP_IQ=firmware_isp_iq.bin,PT_FCSDATA=boot_fcs.bin";
604+
cmdss << string_temp_1 << "combine "<< partitiontable_json_name << " flash_ntz.bin PT_PT=" << partition_bin_name << ",CER_TBL=certable.bin,KEY_CER1=certificate.bin,PT_BL_PRI=boot.bin,PT_FW1=firmware.bin,PT_NN_MDL=nn_model.bin,PT_ISP_IQ=firmware_isp_iq.bin,PT_FCSDATA=boot_fcs.bin";
592605
getline(cmdss, cmd);
593606
cout << cmd << endl;
594607
system(cmd.c_str());
595608
} else {
596609
cmdss.clear();
597-
cmdss << string_temp_1 << "combine amebapro2_partitiontable.json flash_ntz.bin PT_PT=partition.bin,CER_TBL=certable.bin,KEY_CER1=certificate.bin,PT_BL_PRI=boot.bin,PT_FW1=firmware.bin,PT_ISP_IQ=firmware_isp_iq.bin,PT_FCSDATA=boot_fcs.bin";
610+
cmdss << string_temp_1 << "combine "<< partitiontable_json_name << " flash_ntz.bin PT_PT=" << partition_bin_name << ",CER_TBL=certable.bin,KEY_CER1=certificate.bin,PT_BL_PRI=boot.bin,PT_FW1=firmware.bin,PT_ISP_IQ=firmware_isp_iq.bin,PT_FCSDATA=boot_fcs.bin";
598611
getline(cmdss, cmd);
599612
cout << cmd << endl;
600613
system(cmd.c_str());
@@ -623,9 +636,6 @@ int main(int argc, char *argv[]) {
623636
#error compiler is not supported!
624637
#endif
625638

626-
ota_mode_check_name = argv[8];
627-
ota_mode_check(ota_mode_check_name);
628-
629639
if (ota_mode_selection_check == 1) {
630640
cmdss.clear();
631641
cmdss << string_temp_1 << " -E copy "<< string_temp_3 << "firmware.bin "<< string_temp_3 << "ota.bin";

Ameba_misc/Ameba_tools/prebuild_tool/prebuild.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ int main(int argc, char *argv[]) {
3939

4040
// runtime tool path
4141
chdir(argv[1]);
42+
43+
if (strcmp(argv[10], "Enable") == 0 && strcmp(argv[11], "LoadFromFlash") == 0) {
44+
cerr << "OTA is enabled, please select load model from SD card and not load model from flash." << endl;
45+
exit(EXIT_FAILURE);
46+
}
47+
4248
chdir("../..");
4349

4450
isp_camera_option = argv[7];
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
48 Bytes
Binary file not shown.
31.5 KB
Binary file not shown.
Binary file not shown.
-62 KB
Binary file not shown.

0 commit comments

Comments
 (0)