comparison Discovery/Src/externCPU2bootloader.c @ 53:f64cf099a7f5

Allow RTE binaries > 64k size
author Ideenmodellierer
date Sun, 05 Aug 2018 12:57:23 +0200
parents 5f11787b4f42
children 5ca177d2df5d
comparison
equal deleted inserted replaced
52:d24395f7c939 53:f64cf099a7f5
83 else 83 else
84 return 0; 84 return 0;
85 } 85 }
86 86
87 87
88 uint8_t extCPU2bootloader_internal(uint8_t* buffer, uint16_t length, char* display_text) 88 uint8_t extCPU2bootloader_internal(uint8_t* buffer, uint32_t length, char* display_text)
89 { 89 {
90 uint8_t version = 0; 90 uint8_t version = 0;
91 uint16_t chipID = 0; 91 uint16_t chipID = 0;
92 // uint8_t ret; 92 // uint8_t ret;
93 if(!extCPU2bootloader_start(&version,&chipID)) 93 if(!extCPU2bootloader_start(&version,&chipID))
94 return 0; 94 return 0;
95 if(!boot_erase_memory()) 95 if(!boot_erase_memory())
96 return 0; 96 return 0;
97 HAL_Delay(100); 97 HAL_Delay(100);
98 uint16_t i=0; 98 uint16_t i=0;
99 uint16_t lengthsave = length; 99 uint32_t lengthsave = length;
100 uint8_t percent = 0; 100 uint8_t percent = 0;
101 101
102 while(length) 102 while(length)
103 { 103 {
104 percent = (100 * (i * 256)) /lengthsave; 104 percent = (100 * (i * 256)) /lengthsave;
121 } 121 }
122 return 2; 122 return 2;
123 } 123 }
124 124
125 125
126 uint8_t extCPU2bootloader(uint8_t* buffer, uint16_t length, char* display_text) 126 uint8_t extCPU2bootloader(uint8_t* buffer, uint32_t length, char* display_text)
127 { 127 {
128 uint8_t result = 0; 128 uint8_t result = 0;
129 129
130 MX_SmallCPU_Reset_To_Boot(); 130 MX_SmallCPU_Reset_To_Boot();
131 result = extCPU2bootloader_internal(buffer,length,display_text); 131 result = extCPU2bootloader_internal(buffer,length,display_text);