@@ -150,29 +150,29 @@ static int loader(const struct shell *sh)
150
150
memset (ram_firmware , 0 , 64 * 1024 );
151
151
* ram_start = & ram_firmware [0 ];
152
152
}
153
- if (gpio_pin_get_dt (& spec ) == 0 || ( ram_firmware != NULL ) ) {
153
+ if (gpio_pin_get_dt (& spec ) == 0 ) {
154
154
matrixBegin ();
155
155
matrixSetGrayscaleBits (8 );
156
- while (gpio_pin_get_dt (& spec ) == 0 || ( ram_firmware != NULL ) ) {
156
+ while (gpio_pin_get_dt (& spec ) == 0 ) {
157
157
matrixPlay (_bootanimation , _bootanimation_len );
158
- if (ram_firmware != NULL ) {
159
- printk ("Trying to load firmware from RAM: %p\n" , ram_firmware );
160
- // poll the first bytes, if filled try to use them for booting
161
- sketch_hdr = (struct sketch_header_v1 * )(ram_firmware + 7 );
162
- if (sketch_hdr -> ver == 0x1 && sketch_hdr -> magic == 0x2341 ) {
163
- // Found valid data, use it for booting
164
- base_addr = (uintptr_t )ram_firmware ;
165
- * ram_start = 0 ;
166
- break ;
167
- }
168
- }
169
158
}
170
159
matrixPlay (_bootanimation_end , _bootanimation_end_len );
171
160
uint8_t _framebuffer [104 ] = {0 };
172
161
matrixGrayscaleWrite (_framebuffer );
173
162
k_sleep (K_MSEC (10 ));
174
163
matrixEnd ();
175
164
}
165
+ while (!sketch_valid ) {
166
+ __asm__("bkpt" );
167
+ // poll the first bytes, if filled try to use them for booting
168
+ sketch_hdr = (struct sketch_header_v1 * )(ram_firmware + 7 );
169
+ if (sketch_hdr -> ver == 0x1 && sketch_hdr -> magic == 0x2341 ) {
170
+ // Found valid data, use it for booting
171
+ base_addr = (uintptr_t )ram_firmware ;
172
+ * ram_start = 0 ;
173
+ sketch_valid = true;
174
+ }
175
+ }
176
176
}
177
177
#endif
178
178
0 commit comments