123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- /*
- * MBIC_Bootloader.c
- *
- * Created on: 2020. 5. 18.
- * Author: parkyj
- */
- #include "main.h"
- #include "MBIC_Bootloader.h"
- void MBIC_FileDataCheck(uint8_t* data){
- int8_t MBIC_Mark[9] = "JT-NRDAS ";
- int8_t MBIC_FileName1[] = "jhfs-mbic-nrdas-v";
- int8_t MBIC_FileName2[] = "v00.00.01.mbc";
- uint8_t MBIC_type = 0x20;
- uint8_t MBIC_FileType = 0x00;
- int i = 0;
- /***
- MARK Check
- ***/
- for(i = 0; i < 9; i++){
- if(MBIC_Mark[i] != data[i]){
- printf("Data Diff \r\n");
- return;
- }else{
- printf("MARK Data Success \r\n");
- }
- }
- /***
- TYPE Check
- ***/
- for(i = i; i < 10; i++){
- if(MBIC_type != data[i]){
- printf("Data Diff \r\n");
- return;
- }
- else
- printf("Type Data Success \r\n");
- }
- /***
- File Type Check
- ***/
- for(i = i; i < 11; i++){
- if(MBIC_FileType != data[i]){
- printf("Data Diff \r\n");
- return;
- }
- else
- printf("File Type Data Success \r\n");
- }
- /***
- Version Check
- ***/
- for(i = i; i < 14; i++){
- printf("Version Data Success Version %x\r\n",data[i]);
- }
- /***
- File Name Check
- ***/
- for(i = i; i < 30; i++){
- if(MBIC_FileName1[i-14] != data[i]){
- printf("Data Diff \r\n");
- printf("MBIC_FileName1[%d] : %x, data[%d] : %x\r\n",i - 14,MBIC_FileName1[i - 14],i,data[i]);
- return;
- }
- else
- printf("File Name Data Success \r\n");
- }
- for(i = i; i < 43; i++){
- if(MBIC_FileName2[i-30] != data[i]){
- printf("Data Diff %c\r\n",data[i]);
- printf("MBIC_FileName2[%d] : %x, data[%d] : %x\r\n",i - 30,MBIC_FileName2[i - 30],i,data[i]);
- return;
- }
- else
- printf("File Name Data Success %c\r\n",data[i]);
- }
- for(i = i; i < 49; i++){
- printf("Creation Success %x\r\n",data[i]);
- }
- }
-
- void MBIC_Bootloader_FirmwareUpdate(uint8_t* data){
- uint8_t data[1024] = {
- 0x4A,0x54,0x2D,0x4E,0x52,0x44,0x41,0x53,0x20,0x20,0x00,0x00,
- 0x00,0x01,0x6A,0x68,0x66,0x73,0x2D,0x6D,0x62,0x69,0x63,0x2D,
- 0x6E,0x72,0x64,0x61,0x73,0x2D,0x76,0x30,0x30,0x2E,0x30,0x30,0x2E,
- 0x30,0x31,0x2E,0x6D,0x62,0x63,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x14,0x06,0x03,0x10,0x1F,0xC4,0x3C,0x49,
- 0x42,0x98,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
- };
- MBIC_FileDataCheck(data);
-
- uint8_t datatype = data[MBIC_PAYLOADSTART];
- printf("RX");
- for(int i = 0; i < 128; i++)
- printf("%c",*data++);
- switch(datatype){
- case MBIC_Notice_REQ:
-
- break;
- case MBIC_Download_DATA_REQ:
- break;
- case MBIC_Download_Confirm_REQ:
- break;
- case MBIC_Complete_Notice_REQ_REQ:
- break;
- case MBIC_Reboot_Notice_REQ:
- break;
- }
- }
|