Add shared emulator services, waveform generation and STM32 USB boot ports
This commit is contained in:
19
c/set-protocol/ports/stm32f407-usb-boot/boot_image.h
Normal file
19
c/set-protocol/ports/stm32f407-usb-boot/boot_image.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef F407_BOOT_IMAGE_H
|
||||
#define F407_BOOT_IMAGE_H
|
||||
#include "boot_port.h"
|
||||
#include <string.h>
|
||||
|
||||
static inline bool f407_vectors_valid(const uint8_t *image, uint32_t size)
|
||||
{
|
||||
uint32_t sp, pc;
|
||||
if (size < 8 || size > F407_APP_SIZE) return false;
|
||||
memcpy(&sp, image, 4);
|
||||
memcpy(&pc, image + 4, 4);
|
||||
return !(sp & 7) &&
|
||||
((sp > 0x20000000UL && sp <= 0x20020000UL) ||
|
||||
(sp > 0x10000000UL && sp <= 0x10010000UL)) &&
|
||||
(pc & 1) && (pc & ~1UL) >= F407_APP_BASE &&
|
||||
(pc & ~1UL) < F407_APP_BASE + size;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user