mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-16 10:39:49 +00:00
Merge pull request #3726 from cesanta/h5
Add H5 and H7 to health monitor
This commit is contained in:
6 files changed
+19
-11
No files matched your search
+4
-3
@@ -3487,7 +3487,7 @@ struct mg_fs mg_fs_posix = {p_stat, p_list, p_open, p_close, p_read,
|
||||
struct mg_health mg_health_record MG_HEALTH_RAM;
|
||||
|
||||
// STM32 H723 support. Needs the _estack symbol from the linker script
|
||||
#if MG_ENABLE_HEALTH && defined(STM32H723xx_H)
|
||||
#if MG_ENABLE_HEALTH && (defined(STM32H7_DEV_ID) || defined(STM32H5))
|
||||
// Fault handler body. Runs in exception context: no printf, no malloc, no
|
||||
// blocking calls. Copies the unwind registers and raw stack into the health
|
||||
// record, then resets.
|
||||
@@ -26581,11 +26581,12 @@ bool mg_random(void *buf, size_t len) {
|
||||
success = true;
|
||||
#elif MG_ARCH == MG_ARCH_CUBE && defined(HAL_RNG_MODULE_ENABLED)
|
||||
extern RNG_HandleTypeDef hrng;
|
||||
success = true;
|
||||
for (size_t n = 0; n < len; n += sizeof(uint32_t)) {
|
||||
uint32_t r = HAL_RNG_ReadLastRandomNumber(&hrng);
|
||||
uint32_t r = 0;
|
||||
if (HAL_RNG_GenerateRandomNumber(&hrng, &r) != HAL_OK) success = false;
|
||||
memcpy((char *) buf + n, &r, n + sizeof(r) > len ? len - n : sizeof(r));
|
||||
}
|
||||
success = true;
|
||||
#elif MG_ARCH == MG_ARCH_PICOSDK
|
||||
while (len--) *p++ = (unsigned char) (get_rand_32() & 255);
|
||||
success = true;
|
||||
|
||||
+5
-1
@@ -4927,6 +4927,10 @@ void mg_ota_poll(struct mg_mgr *);
|
||||
#define MG_HEALTH_MAGIC {'M', 'G', 'H', '3'} // '3' is the layout version
|
||||
#endif
|
||||
|
||||
#if !defined(MG_HEALTH_RAM) && (defined(STM32H7_DEV_ID) || defined(STM32H5))
|
||||
#define MG_HEALTH_RAM __attribute__((section(".mg_health")))
|
||||
#endif
|
||||
|
||||
// Places the record in RAM that survives a reset. Define in mongoose_config.h
|
||||
// to match the linker script, e.g. __attribute__((section(".mg_health")))
|
||||
#ifndef MG_HEALTH_RAM
|
||||
@@ -4948,7 +4952,7 @@ enum mg_health_reason {
|
||||
};
|
||||
|
||||
#ifndef MG_HEALTH_DATA_SIZE
|
||||
#define MG_HEALTH_DATA_SIZE 20
|
||||
#define MG_HEALTH_DATA_SIZE 250
|
||||
#endif
|
||||
|
||||
struct mg_health {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
struct mg_health mg_health_record MG_HEALTH_RAM;
|
||||
|
||||
// STM32 H723 support. Needs the _estack symbol from the linker script
|
||||
#if MG_ENABLE_HEALTH && defined(STM32H723xx_H)
|
||||
#if MG_ENABLE_HEALTH && (defined(STM32H7_DEV_ID) || defined(STM32H5))
|
||||
// Fault handler body. Runs in exception context: no printf, no malloc, no
|
||||
// blocking calls. Copies the unwind registers and raw stack into the health
|
||||
// record, then resets.
|
||||
|
||||
+5
-1
@@ -9,6 +9,10 @@
|
||||
#define MG_HEALTH_MAGIC {'M', 'G', 'H', '3'} // '3' is the layout version
|
||||
#endif
|
||||
|
||||
#if !defined(MG_HEALTH_RAM) && (defined(STM32H7_DEV_ID) || defined(STM32H5))
|
||||
#define MG_HEALTH_RAM __attribute__((section(".mg_health")))
|
||||
#endif
|
||||
|
||||
// Places the record in RAM that survives a reset. Define in mongoose_config.h
|
||||
// to match the linker script, e.g. __attribute__((section(".mg_health")))
|
||||
#ifndef MG_HEALTH_RAM
|
||||
@@ -30,7 +34,7 @@ enum mg_health_reason {
|
||||
};
|
||||
|
||||
#ifndef MG_HEALTH_DATA_SIZE
|
||||
#define MG_HEALTH_DATA_SIZE 20
|
||||
#define MG_HEALTH_DATA_SIZE 250
|
||||
#endif
|
||||
|
||||
struct mg_health {
|
||||
|
||||
+3
-2
@@ -43,11 +43,12 @@ bool mg_random(void *buf, size_t len) {
|
||||
success = true;
|
||||
#elif MG_ARCH == MG_ARCH_CUBE && defined(HAL_RNG_MODULE_ENABLED)
|
||||
extern RNG_HandleTypeDef hrng;
|
||||
success = true;
|
||||
for (size_t n = 0; n < len; n += sizeof(uint32_t)) {
|
||||
uint32_t r = HAL_RNG_ReadLastRandomNumber(&hrng);
|
||||
uint32_t r = 0;
|
||||
if (HAL_RNG_GenerateRandomNumber(&hrng, &r) != HAL_OK) success = false;
|
||||
memcpy((char *) buf + n, &r, n + sizeof(r) > len ? len - n : sizeof(r));
|
||||
}
|
||||
success = true;
|
||||
#elif MG_ARCH == MG_ARCH_PICOSDK
|
||||
while (len--) *p++ = (unsigned char) (get_rand_32() & 255);
|
||||
success = true;
|
||||
|
||||
@@ -28,10 +28,8 @@
|
||||
|
||||
// Crash report support. Health record lives in the .mg_health region, see link.ld
|
||||
#define MG_ENABLE_HEALTH 1
|
||||
#define MG_HEALTH_RAM __attribute__((section(".mg_health")))
|
||||
#define MG_HEALTH_DATA_SIZE 1000
|
||||
|
||||
// mdash.net device management service support
|
||||
#define MG_ENABLE_MDASH 0
|
||||
#define MG_MDASH_KEY "..." // Set this - mDash device token
|
||||
#define MG_FIRMWARE_VERSION "1.0.0"
|
||||
#define MG_FIRMWARE_VERSION "h723.1.0.0"
|
||||
Reference in new issue
Block a user