Prusa MINI Firmware overview
|
Go to the documentation of this file.
37 #ifndef __STM32F4xx_HAL_FLASH_EX_H
38 #define __STM32F4xx_HAL_FLASH_EX_H
112 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
113 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
114 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
115 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
116 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
125 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
126 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
132 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
136 uint16_t SectorsBank1;
139 uint16_t SectorsBank2;
146 }FLASH_AdvOBProgramInitTypeDef;
162 #define FLASH_TYPEERASE_SECTORS 0x00000000U
163 #define FLASH_TYPEERASE_MASSERASE 0x00000001U
171 #define FLASH_VOLTAGE_RANGE_1 0x00000000U
172 #define FLASH_VOLTAGE_RANGE_2 0x00000001U
173 #define FLASH_VOLTAGE_RANGE_3 0x00000002U
174 #define FLASH_VOLTAGE_RANGE_4 0x00000003U
182 #define OB_WRPSTATE_DISABLE 0x00000000U
183 #define OB_WRPSTATE_ENABLE 0x00000001U
191 #define OPTIONBYTE_WRP 0x00000001U
192 #define OPTIONBYTE_RDP 0x00000002U
193 #define OPTIONBYTE_USER 0x00000004U
194 #define OPTIONBYTE_BOR 0x00000008U
202 #define OB_RDP_LEVEL_0 ((uint8_t)0xAA)
203 #define OB_RDP_LEVEL_1 ((uint8_t)0x55)
204 #define OB_RDP_LEVEL_2 ((uint8_t)0xCC)
213 #define OB_IWDG_SW ((uint8_t)0x20)
214 #define OB_IWDG_HW ((uint8_t)0x00)
222 #define OB_STOP_NO_RST ((uint8_t)0x40)
223 #define OB_STOP_RST ((uint8_t)0x00)
232 #define OB_STDBY_NO_RST ((uint8_t)0x80)
233 #define OB_STDBY_RST ((uint8_t)0x00)
241 #define OB_BOR_LEVEL3 ((uint8_t)0x00)
242 #define OB_BOR_LEVEL2 ((uint8_t)0x04)
243 #define OB_BOR_LEVEL1 ((uint8_t)0x08)
244 #define OB_BOR_OFF ((uint8_t)0x0C)
249 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
250 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
251 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
252 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
253 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
257 #define OB_PCROP_STATE_DISABLE 0x00000000U
258 #define OB_PCROP_STATE_ENABLE 0x00000001U
269 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
270 defined(STM32F469xx) || defined(STM32F479xx)
271 #define OPTIONBYTE_PCROP 0x00000001U
272 #define OPTIONBYTE_BOOTCONFIG 0x00000002U
275 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
276 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
277 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
279 #define OPTIONBYTE_PCROP 0x00000001U
290 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
291 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
292 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS
293 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS
294 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS
295 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS
296 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS
297 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS
298 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS
299 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS
300 #define FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS
301 #define FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS
302 #define FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS
303 #define FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS
304 #define FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS
305 #define FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS
306 #define FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS
307 #define FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS
312 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
313 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
314 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\
315 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
317 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS
318 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS
319 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS
320 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS
321 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS
322 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS
323 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS
324 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS
337 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
338 defined(STM32F469xx) || defined(STM32F479xx)
339 #define FLASH_BANK_1 1U
340 #define FLASH_BANK_2 2U
341 #define FLASH_BANK_BOTH ((uint32_t)FLASH_BANK_1 | FLASH_BANK_2)
344 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
345 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
346 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
347 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
349 #define FLASH_BANK_1 1U
359 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
360 defined(STM32F469xx) || defined(STM32F479xx)
361 #define FLASH_MER_BIT (FLASH_CR_MER1 | FLASH_CR_MER2)
364 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
365 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
366 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
367 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
369 #define FLASH_MER_BIT (FLASH_CR_MER)
380 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
381 defined(STM32F469xx) || defined(STM32F479xx)
382 #define FLASH_SECTOR_0 0U
383 #define FLASH_SECTOR_1 1U
384 #define FLASH_SECTOR_2 2U
385 #define FLASH_SECTOR_3 3U
386 #define FLASH_SECTOR_4 4U
387 #define FLASH_SECTOR_5 5U
388 #define FLASH_SECTOR_6 6U
389 #define FLASH_SECTOR_7 7U
390 #define FLASH_SECTOR_8 8U
391 #define FLASH_SECTOR_9 9U
392 #define FLASH_SECTOR_10 10U
393 #define FLASH_SECTOR_11 11U
394 #define FLASH_SECTOR_12 12U
395 #define FLASH_SECTOR_13 13U
396 #define FLASH_SECTOR_14 14U
397 #define FLASH_SECTOR_15 15U
398 #define FLASH_SECTOR_16 16U
399 #define FLASH_SECTOR_17 17U
400 #define FLASH_SECTOR_18 18U
401 #define FLASH_SECTOR_19 19U
402 #define FLASH_SECTOR_20 20U
403 #define FLASH_SECTOR_21 21U
404 #define FLASH_SECTOR_22 22U
405 #define FLASH_SECTOR_23 23U
410 #if defined(STM32F413xx) || defined(STM32F423xx)
411 #define FLASH_SECTOR_0 0U
412 #define FLASH_SECTOR_1 1U
413 #define FLASH_SECTOR_2 2U
414 #define FLASH_SECTOR_3 3U
415 #define FLASH_SECTOR_4 4U
416 #define FLASH_SECTOR_5 5U
417 #define FLASH_SECTOR_6 6U
418 #define FLASH_SECTOR_7 7U
419 #define FLASH_SECTOR_8 8U
420 #define FLASH_SECTOR_9 9U
421 #define FLASH_SECTOR_10 10U
422 #define FLASH_SECTOR_11 11U
423 #define FLASH_SECTOR_12 12U
424 #define FLASH_SECTOR_13 13U
425 #define FLASH_SECTOR_14 14U
426 #define FLASH_SECTOR_15 15U
431 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\
432 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
433 #define FLASH_SECTOR_0 0U
434 #define FLASH_SECTOR_1 1U
435 #define FLASH_SECTOR_2 2U
436 #define FLASH_SECTOR_3 3U
437 #define FLASH_SECTOR_4 4U
438 #define FLASH_SECTOR_5 5U
439 #define FLASH_SECTOR_6 6U
440 #define FLASH_SECTOR_7 7U
441 #define FLASH_SECTOR_8 8U
442 #define FLASH_SECTOR_9 9U
443 #define FLASH_SECTOR_10 10U
444 #define FLASH_SECTOR_11 11U
449 #if defined(STM32F401xC)
450 #define FLASH_SECTOR_0 0U
451 #define FLASH_SECTOR_1 1U
452 #define FLASH_SECTOR_2 2U
453 #define FLASH_SECTOR_3 3U
454 #define FLASH_SECTOR_4 4U
455 #define FLASH_SECTOR_5 5U
460 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
461 #define FLASH_SECTOR_0 0U
462 #define FLASH_SECTOR_1 1U
463 #define FLASH_SECTOR_2 2U
464 #define FLASH_SECTOR_3 3U
465 #define FLASH_SECTOR_4 4U
470 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
471 #define FLASH_SECTOR_0 0U
472 #define FLASH_SECTOR_1 1U
473 #define FLASH_SECTOR_2 2U
474 #define FLASH_SECTOR_3 3U
475 #define FLASH_SECTOR_4 4U
476 #define FLASH_SECTOR_5 5U
477 #define FLASH_SECTOR_6 6U
478 #define FLASH_SECTOR_7 7U
490 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
491 defined(STM32F469xx) || defined(STM32F479xx)
492 #define OB_WRP_SECTOR_0 0x00000001U
493 #define OB_WRP_SECTOR_1 0x00000002U
494 #define OB_WRP_SECTOR_2 0x00000004U
495 #define OB_WRP_SECTOR_3 0x00000008U
496 #define OB_WRP_SECTOR_4 0x00000010U
497 #define OB_WRP_SECTOR_5 0x00000020U
498 #define OB_WRP_SECTOR_6 0x00000040U
499 #define OB_WRP_SECTOR_7 0x00000080U
500 #define OB_WRP_SECTOR_8 0x00000100U
501 #define OB_WRP_SECTOR_9 0x00000200U
502 #define OB_WRP_SECTOR_10 0x00000400U
503 #define OB_WRP_SECTOR_11 0x00000800U
504 #define OB_WRP_SECTOR_12 0x00000001U << 12U
505 #define OB_WRP_SECTOR_13 0x00000002U << 12U
506 #define OB_WRP_SECTOR_14 0x00000004U << 12U
507 #define OB_WRP_SECTOR_15 0x00000008U << 12U
508 #define OB_WRP_SECTOR_16 0x00000010U << 12U
509 #define OB_WRP_SECTOR_17 0x00000020U << 12U
510 #define OB_WRP_SECTOR_18 0x00000040U << 12U
511 #define OB_WRP_SECTOR_19 0x00000080U << 12U
512 #define OB_WRP_SECTOR_20 0x00000100U << 12U
513 #define OB_WRP_SECTOR_21 0x00000200U << 12U
514 #define OB_WRP_SECTOR_22 0x00000400U << 12U
515 #define OB_WRP_SECTOR_23 0x00000800U << 12U
516 #define OB_WRP_SECTOR_All 0x00000FFFU << 12U
521 #if defined(STM32F413xx) || defined(STM32F423xx)
522 #define OB_WRP_SECTOR_0 0x00000001U
523 #define OB_WRP_SECTOR_1 0x00000002U
524 #define OB_WRP_SECTOR_2 0x00000004U
525 #define OB_WRP_SECTOR_3 0x00000008U
526 #define OB_WRP_SECTOR_4 0x00000010U
527 #define OB_WRP_SECTOR_5 0x00000020U
528 #define OB_WRP_SECTOR_6 0x00000040U
529 #define OB_WRP_SECTOR_7 0x00000080U
530 #define OB_WRP_SECTOR_8 0x00000100U
531 #define OB_WRP_SECTOR_9 0x00000200U
532 #define OB_WRP_SECTOR_10 0x00000400U
533 #define OB_WRP_SECTOR_11 0x00000800U
534 #define OB_WRP_SECTOR_12 0x00001000U
535 #define OB_WRP_SECTOR_13 0x00002000U
536 #define OB_WRP_SECTOR_14 0x00004000U
537 #define OB_WRP_SECTOR_15 0x00004000U
538 #define OB_WRP_SECTOR_All 0x00007FFFU
543 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\
544 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
545 #define OB_WRP_SECTOR_0 0x00000001U
546 #define OB_WRP_SECTOR_1 0x00000002U
547 #define OB_WRP_SECTOR_2 0x00000004U
548 #define OB_WRP_SECTOR_3 0x00000008U
549 #define OB_WRP_SECTOR_4 0x00000010U
550 #define OB_WRP_SECTOR_5 0x00000020U
551 #define OB_WRP_SECTOR_6 0x00000040U
552 #define OB_WRP_SECTOR_7 0x00000080U
553 #define OB_WRP_SECTOR_8 0x00000100U
554 #define OB_WRP_SECTOR_9 0x00000200U
555 #define OB_WRP_SECTOR_10 0x00000400U
556 #define OB_WRP_SECTOR_11 0x00000800U
557 #define OB_WRP_SECTOR_All 0x00000FFFU
562 #if defined(STM32F401xC)
563 #define OB_WRP_SECTOR_0 0x00000001U
564 #define OB_WRP_SECTOR_1 0x00000002U
565 #define OB_WRP_SECTOR_2 0x00000004U
566 #define OB_WRP_SECTOR_3 0x00000008U
567 #define OB_WRP_SECTOR_4 0x00000010U
568 #define OB_WRP_SECTOR_5 0x00000020U
569 #define OB_WRP_SECTOR_All 0x00000FFFU
574 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
575 #define OB_WRP_SECTOR_0 0x00000001U
576 #define OB_WRP_SECTOR_1 0x00000002U
577 #define OB_WRP_SECTOR_2 0x00000004U
578 #define OB_WRP_SECTOR_3 0x00000008U
579 #define OB_WRP_SECTOR_4 0x00000010U
580 #define OB_WRP_SECTOR_All 0x00000FFFU
585 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
586 #define OB_WRP_SECTOR_0 0x00000001U
587 #define OB_WRP_SECTOR_1 0x00000002U
588 #define OB_WRP_SECTOR_2 0x00000004U
589 #define OB_WRP_SECTOR_3 0x00000008U
590 #define OB_WRP_SECTOR_4 0x00000010U
591 #define OB_WRP_SECTOR_5 0x00000020U
592 #define OB_WRP_SECTOR_6 0x00000040U
593 #define OB_WRP_SECTOR_7 0x00000080U
594 #define OB_WRP_SECTOR_All 0x00000FFFU
605 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
606 defined(STM32F469xx) || defined(STM32F479xx)
607 #define OB_PCROP_SECTOR_0 0x00000001U
608 #define OB_PCROP_SECTOR_1 0x00000002U
609 #define OB_PCROP_SECTOR_2 0x00000004U
610 #define OB_PCROP_SECTOR_3 0x00000008U
611 #define OB_PCROP_SECTOR_4 0x00000010U
612 #define OB_PCROP_SECTOR_5 0x00000020U
613 #define OB_PCROP_SECTOR_6 0x00000040U
614 #define OB_PCROP_SECTOR_7 0x00000080U
615 #define OB_PCROP_SECTOR_8 0x00000100U
616 #define OB_PCROP_SECTOR_9 0x00000200U
617 #define OB_PCROP_SECTOR_10 0x00000400U
618 #define OB_PCROP_SECTOR_11 0x00000800U
619 #define OB_PCROP_SECTOR_12 0x00000001U
620 #define OB_PCROP_SECTOR_13 0x00000002U
621 #define OB_PCROP_SECTOR_14 0x00000004U
622 #define OB_PCROP_SECTOR_15 0x00000008U
623 #define OB_PCROP_SECTOR_16 0x00000010U
624 #define OB_PCROP_SECTOR_17 0x00000020U
625 #define OB_PCROP_SECTOR_18 0x00000040U
626 #define OB_PCROP_SECTOR_19 0x00000080U
627 #define OB_PCROP_SECTOR_20 0x00000100U
628 #define OB_PCROP_SECTOR_21 0x00000200U
629 #define OB_PCROP_SECTOR_22 0x00000400U
630 #define OB_PCROP_SECTOR_23 0x00000800U
631 #define OB_PCROP_SECTOR_All 0x00000FFFU
636 #if defined(STM32F413xx) || defined(STM32F423xx)
637 #define OB_PCROP_SECTOR_0 0x00000001U
638 #define OB_PCROP_SECTOR_1 0x00000002U
639 #define OB_PCROP_SECTOR_2 0x00000004U
640 #define OB_PCROP_SECTOR_3 0x00000008U
641 #define OB_PCROP_SECTOR_4 0x00000010U
642 #define OB_PCROP_SECTOR_5 0x00000020U
643 #define OB_PCROP_SECTOR_6 0x00000040U
644 #define OB_PCROP_SECTOR_7 0x00000080U
645 #define OB_PCROP_SECTOR_8 0x00000100U
646 #define OB_PCROP_SECTOR_9 0x00000200U
647 #define OB_PCROP_SECTOR_10 0x00000400U
648 #define OB_PCROP_SECTOR_11 0x00000800U
649 #define OB_PCROP_SECTOR_12 0x00001000U
650 #define OB_PCROP_SECTOR_13 0x00002000U
651 #define OB_PCROP_SECTOR_14 0x00004000U
652 #define OB_PCROP_SECTOR_15 0x00004000U
653 #define OB_PCROP_SECTOR_All 0x00007FFFU
658 #if defined(STM32F401xC)
659 #define OB_PCROP_SECTOR_0 0x00000001U
660 #define OB_PCROP_SECTOR_1 0x00000002U
661 #define OB_PCROP_SECTOR_2 0x00000004U
662 #define OB_PCROP_SECTOR_3 0x00000008U
663 #define OB_PCROP_SECTOR_4 0x00000010U
664 #define OB_PCROP_SECTOR_5 0x00000020U
665 #define OB_PCROP_SECTOR_All 0x00000FFFU
670 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
671 #define OB_PCROP_SECTOR_0 0x00000001U
672 #define OB_PCROP_SECTOR_1 0x00000002U
673 #define OB_PCROP_SECTOR_2 0x00000004U
674 #define OB_PCROP_SECTOR_3 0x00000008U
675 #define OB_PCROP_SECTOR_4 0x00000010U
676 #define OB_PCROP_SECTOR_All 0x00000FFFU
681 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
682 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
683 #define OB_PCROP_SECTOR_0 0x00000001U
684 #define OB_PCROP_SECTOR_1 0x00000002U
685 #define OB_PCROP_SECTOR_2 0x00000004U
686 #define OB_PCROP_SECTOR_3 0x00000008U
687 #define OB_PCROP_SECTOR_4 0x00000010U
688 #define OB_PCROP_SECTOR_5 0x00000020U
689 #define OB_PCROP_SECTOR_6 0x00000040U
690 #define OB_PCROP_SECTOR_7 0x00000080U
691 #define OB_PCROP_SECTOR_All 0x00000FFFU
702 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
703 defined(STM32F469xx) || defined(STM32F479xx)
704 #define OB_DUAL_BOOT_ENABLE ((uint8_t)0x10)
705 #define OB_DUAL_BOOT_DISABLE ((uint8_t)0x00)
714 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
715 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
716 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
717 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
718 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
719 #define OB_PCROP_DESELECTED ((uint8_t)0x00)
720 #define OB_PCROP_SELECTED ((uint8_t)0x80)
748 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
749 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
750 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
751 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
752 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
753 HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
754 void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
761 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
762 defined(STM32F469xx) || defined(STM32F479xx)
763 uint16_t HAL_FLASHEx_OB_GetBank2WRP(
void);
779 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
780 #define FLASH_SECTOR_TOTAL 24U
784 #if defined(STM32F413xx) || defined(STM32F423xx)
785 #define FLASH_SECTOR_TOTAL 16U
789 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\
790 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
791 #define FLASH_SECTOR_TOTAL 12U
795 #if defined(STM32F401xC)
796 #define FLASH_SECTOR_TOTAL 6U
800 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
801 #define FLASH_SECTOR_TOTAL 5U
805 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
806 #define FLASH_SECTOR_TOTAL 8U
812 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
813 #define OPTCR1_BYTE2_ADDRESS 0x40023C1AU
829 #define IS_FLASH_TYPEERASE(VALUE)(((VALUE) == FLASH_TYPEERASE_SECTORS) || \
830 ((VALUE) == FLASH_TYPEERASE_MASSERASE))
832 #define IS_VOLTAGERANGE(RANGE)(((RANGE) == FLASH_VOLTAGE_RANGE_1) || \
833 ((RANGE) == FLASH_VOLTAGE_RANGE_2) || \
834 ((RANGE) == FLASH_VOLTAGE_RANGE_3) || \
835 ((RANGE) == FLASH_VOLTAGE_RANGE_4))
837 #define IS_WRPSTATE(VALUE)(((VALUE) == OB_WRPSTATE_DISABLE) || \
838 ((VALUE) == OB_WRPSTATE_ENABLE))
840 #define IS_OPTIONBYTE(VALUE)(((VALUE) <= (OPTIONBYTE_WRP|OPTIONBYTE_RDP|OPTIONBYTE_USER|OPTIONBYTE_BOR)))
842 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
843 ((LEVEL) == OB_RDP_LEVEL_1) ||\
844 ((LEVEL) == OB_RDP_LEVEL_2))
846 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
848 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
850 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
852 #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL1) || ((LEVEL) == OB_BOR_LEVEL2) ||\
853 ((LEVEL) == OB_BOR_LEVEL3) || ((LEVEL) == OB_BOR_OFF))
855 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
856 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
857 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
858 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
859 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
860 #define IS_PCROPSTATE(VALUE)(((VALUE) == OB_PCROP_STATE_DISABLE) || \
861 ((VALUE) == OB_PCROP_STATE_ENABLE))
866 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
867 defined(STM32F469xx) || defined(STM32F479xx)
868 #define IS_OBEX(VALUE)(((VALUE) == OPTIONBYTE_PCROP) || \
869 ((VALUE) == OPTIONBYTE_BOOTCONFIG))
872 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
873 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
874 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
876 #define IS_OBEX(VALUE)(((VALUE) == OPTIONBYTE_PCROP))
880 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
881 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
882 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
883 ((LATENCY) == FLASH_LATENCY_1) || \
884 ((LATENCY) == FLASH_LATENCY_2) || \
885 ((LATENCY) == FLASH_LATENCY_3) || \
886 ((LATENCY) == FLASH_LATENCY_4) || \
887 ((LATENCY) == FLASH_LATENCY_5) || \
888 ((LATENCY) == FLASH_LATENCY_6) || \
889 ((LATENCY) == FLASH_LATENCY_7) || \
890 ((LATENCY) == FLASH_LATENCY_8) || \
891 ((LATENCY) == FLASH_LATENCY_9) || \
892 ((LATENCY) == FLASH_LATENCY_10) || \
893 ((LATENCY) == FLASH_LATENCY_11) || \
894 ((LATENCY) == FLASH_LATENCY_12) || \
895 ((LATENCY) == FLASH_LATENCY_13) || \
896 ((LATENCY) == FLASH_LATENCY_14) || \
897 ((LATENCY) == FLASH_LATENCY_15))
900 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
901 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
902 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\
903 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
904 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
905 ((LATENCY) == FLASH_LATENCY_1) || \
906 ((LATENCY) == FLASH_LATENCY_2) || \
907 ((LATENCY) == FLASH_LATENCY_3) || \
908 ((LATENCY) == FLASH_LATENCY_4) || \
909 ((LATENCY) == FLASH_LATENCY_5) || \
910 ((LATENCY) == FLASH_LATENCY_6) || \
911 ((LATENCY) == FLASH_LATENCY_7))
915 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
916 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \
917 ((BANK) == FLASH_BANK_2) || \
918 ((BANK) == FLASH_BANK_BOTH))
921 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
922 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
923 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
924 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
926 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1))
930 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
931 #define IS_FLASH_SECTOR(SECTOR) ( ((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
932 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
933 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
934 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\
935 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\
936 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11) ||\
937 ((SECTOR) == FLASH_SECTOR_12) || ((SECTOR) == FLASH_SECTOR_13) ||\
938 ((SECTOR) == FLASH_SECTOR_14) || ((SECTOR) == FLASH_SECTOR_15) ||\
939 ((SECTOR) == FLASH_SECTOR_16) || ((SECTOR) == FLASH_SECTOR_17) ||\
940 ((SECTOR) == FLASH_SECTOR_18) || ((SECTOR) == FLASH_SECTOR_19) ||\
941 ((SECTOR) == FLASH_SECTOR_20) || ((SECTOR) == FLASH_SECTOR_21) ||\
942 ((SECTOR) == FLASH_SECTOR_22) || ((SECTOR) == FLASH_SECTOR_23))
945 #if defined(STM32F413xx) || defined(STM32F423xx)
946 #define IS_FLASH_SECTOR(SECTOR) ( ((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
947 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
948 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
949 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\
950 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\
951 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11) ||\
952 ((SECTOR) == FLASH_SECTOR_12) || ((SECTOR) == FLASH_SECTOR_13) ||\
953 ((SECTOR) == FLASH_SECTOR_14) || ((SECTOR) == FLASH_SECTOR_15))
956 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\
957 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
958 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
959 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
960 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
961 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\
962 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\
963 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11))
966 #if defined(STM32F401xC)
967 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
968 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
969 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5))
972 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
973 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
974 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
975 ((SECTOR) == FLASH_SECTOR_4))
978 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
979 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
980 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
981 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
982 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7))
985 #define IS_FLASH_ADDRESS(ADDRESS) ((((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_END)) || \
986 (((ADDRESS) >= FLASH_OTP_BASE) && ((ADDRESS) <= FLASH_OTP_END)))
988 #define IS_FLASH_NBSECTORS(NBSECTORS) (((NBSECTORS) != 0) && ((NBSECTORS) <= FLASH_SECTOR_TOTAL))
990 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
991 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFF000000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
994 #if defined(STM32F413xx) || defined(STM32F423xx)
995 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFF8000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
998 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
999 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
1002 #if defined(STM32F401xC)
1003 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
1006 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
1007 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
1010 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\
1011 defined(STM32F412Rx) || defined(STM32F412Cx)
1012 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
1015 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
1016 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
1019 #if defined(STM32F413xx) || defined(STM32F423xx)
1020 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFF8000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
1023 #if defined(STM32F401xC)
1024 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
1027 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
1028 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
1031 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\
1032 defined(STM32F412Rx) || defined(STM32F412Cx)
1033 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U))
1036 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
1037 defined(STM32F469xx) || defined(STM32F479xx)
1038 #define IS_OB_BOOT(BOOT) (((BOOT) == OB_DUAL_BOOT_ENABLE) || ((BOOT) == OB_DUAL_BOOT_DISABLE))
1041 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
1042 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
1043 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
1044 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
1045 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
1046 #define IS_OB_PCROP_SELECT(PCROP) (((PCROP) == OB_PCROP_SELECTED) || ((PCROP) == OB_PCROP_DESELECTED))
FLASH Option Bytes Program structure definition.
Definition: stm32f4xx_hal_flash_ex.h:85
uint32_t NbSectors
Definition: stm32f4xx_hal_flash_ex.h:74
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *SectorError)
void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit)
uint8_t USERConfig
Definition: stm32f4xx_hal_flash_ex.h:105
uint32_t Sector
Definition: stm32f4xx_hal_flash_ex.h:71
uint32_t WRPState
Definition: stm32f4xx_hal_flash_ex.h:90
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32f4xx_hal_def.h:55
uint32_t RDPLevel
Definition: stm32f4xx_hal_flash_ex.h:99
HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit)
uint32_t BORLevel
Definition: stm32f4xx_hal_flash_ex.h:102
uint32_t TypeErase
Definition: stm32f4xx_hal_flash_ex.h:65
void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange)
uint32_t VoltageRange
Definition: stm32f4xx_hal_flash_ex.h:77
const uint8_t[]
Definition: 404_html.c:3
HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit)
uint32_t Banks
Definition: stm32f4xx_hal_flash_ex.h:96
void FLASH_FlushCaches(void)
uint32_t Banks
Definition: stm32f4xx_hal_flash_ex.h:68
uint32_t OptionType
Definition: stm32f4xx_hal_flash_ex.h:87
FLASH Erase structure definition.
Definition: stm32f4xx_hal_flash_ex.h:63
uint32_t WRPSector
Definition: stm32f4xx_hal_flash_ex.h:93