39 #ifndef __STM32F4xx_HAL_FLASH_EX_H 40 #define __STM32F4xx_HAL_FLASH_EX_H 114 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 115 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 116 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 117 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 127 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 128 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 134 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 138 uint16_t SectorsBank1;
141 uint16_t SectorsBank2;
148 }FLASH_AdvOBProgramInitTypeDef;
163 #define FLASH_TYPEERASE_SECTORS ((uint32_t)0x00U) 164 #define FLASH_TYPEERASE_MASSERASE ((uint32_t)0x01U) 172 #define FLASH_VOLTAGE_RANGE_1 ((uint32_t)0x00U) 173 #define FLASH_VOLTAGE_RANGE_2 ((uint32_t)0x01U) 174 #define FLASH_VOLTAGE_RANGE_3 ((uint32_t)0x02U) 175 #define FLASH_VOLTAGE_RANGE_4 ((uint32_t)0x03U) 183 #define OB_WRPSTATE_DISABLE ((uint32_t)0x00U) 184 #define OB_WRPSTATE_ENABLE ((uint32_t)0x01U) 192 #define OPTIONBYTE_WRP ((uint32_t)0x01U) 193 #define OPTIONBYTE_RDP ((uint32_t)0x02U) 194 #define OPTIONBYTE_USER ((uint32_t)0x04U) 195 #define OPTIONBYTE_BOR ((uint32_t)0x08U) 203 #define OB_RDP_LEVEL_0 ((uint8_t)0xAAU) 204 #define OB_RDP_LEVEL_1 ((uint8_t)0x55U) 205 #define OB_RDP_LEVEL_2 ((uint8_t)0xCCU) 214 #define OB_IWDG_SW ((uint8_t)0x20U) 215 #define OB_IWDG_HW ((uint8_t)0x00U) 223 #define OB_STOP_NO_RST ((uint8_t)0x40U) 224 #define OB_STOP_RST ((uint8_t)0x00U) 233 #define OB_STDBY_NO_RST ((uint8_t)0x80U) 234 #define OB_STDBY_RST ((uint8_t)0x00U) 242 #define OB_BOR_LEVEL3 ((uint8_t)0x00U) 243 #define OB_BOR_LEVEL2 ((uint8_t)0x04U) 244 #define OB_BOR_LEVEL1 ((uint8_t)0x08U) 245 #define OB_BOR_OFF ((uint8_t)0x0CU) 250 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 251 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 252 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 253 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 258 #define OB_PCROP_STATE_DISABLE ((uint32_t)0x00U) 259 #define OB_PCROP_STATE_ENABLE ((uint32_t)0x01U) 271 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 272 defined(STM32F469xx) || defined(STM32F479xx) 273 #define OPTIONBYTE_PCROP ((uint32_t)0x01U) 274 #define OPTIONBYTE_BOOTCONFIG ((uint32_t)0x02U) 277 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 278 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 279 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 280 #define OPTIONBYTE_PCROP ((uint32_t)0x01U) 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) 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 336 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 337 defined(STM32F469xx) || defined(STM32F479xx) 338 #define FLASH_BANK_1 ((uint32_t)1U) 339 #define FLASH_BANK_2 ((uint32_t)2U) 340 #define FLASH_BANK_BOTH ((uint32_t)FLASH_BANK_1 | FLASH_BANK_2) 343 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ 344 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 345 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 346 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 347 #define FLASH_BANK_1 ((uint32_t)1U) 356 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 357 defined(STM32F469xx) || defined(STM32F479xx) 358 #define FLASH_MER_BIT (FLASH_CR_MER1 | FLASH_CR_MER2) 361 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ 362 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 363 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 364 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 365 #define FLASH_MER_BIT (FLASH_CR_MER) 375 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 376 defined(STM32F469xx) || defined(STM32F479xx) 377 #define FLASH_SECTOR_0 ((uint32_t)0U) 378 #define FLASH_SECTOR_1 ((uint32_t)1U) 379 #define FLASH_SECTOR_2 ((uint32_t)2U) 380 #define FLASH_SECTOR_3 ((uint32_t)3U) 381 #define FLASH_SECTOR_4 ((uint32_t)4U) 382 #define FLASH_SECTOR_5 ((uint32_t)5U) 383 #define FLASH_SECTOR_6 ((uint32_t)6U) 384 #define FLASH_SECTOR_7 ((uint32_t)7U) 385 #define FLASH_SECTOR_8 ((uint32_t)8U) 386 #define FLASH_SECTOR_9 ((uint32_t)9U) 387 #define FLASH_SECTOR_10 ((uint32_t)10U) 388 #define FLASH_SECTOR_11 ((uint32_t)11U) 389 #define FLASH_SECTOR_12 ((uint32_t)12U) 390 #define FLASH_SECTOR_13 ((uint32_t)13U) 391 #define FLASH_SECTOR_14 ((uint32_t)14U) 392 #define FLASH_SECTOR_15 ((uint32_t)15U) 393 #define FLASH_SECTOR_16 ((uint32_t)16U) 394 #define FLASH_SECTOR_17 ((uint32_t)17U) 395 #define FLASH_SECTOR_18 ((uint32_t)18U) 396 #define FLASH_SECTOR_19 ((uint32_t)19U) 397 #define FLASH_SECTOR_20 ((uint32_t)20U) 398 #define FLASH_SECTOR_21 ((uint32_t)21U) 399 #define FLASH_SECTOR_22 ((uint32_t)22U) 400 #define FLASH_SECTOR_23 ((uint32_t)23U) 405 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ 406 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 407 #define FLASH_SECTOR_0 ((uint32_t)0U) 408 #define FLASH_SECTOR_1 ((uint32_t)1U) 409 #define FLASH_SECTOR_2 ((uint32_t)2U) 410 #define FLASH_SECTOR_3 ((uint32_t)3U) 411 #define FLASH_SECTOR_4 ((uint32_t)4U) 412 #define FLASH_SECTOR_5 ((uint32_t)5U) 413 #define FLASH_SECTOR_6 ((uint32_t)6U) 414 #define FLASH_SECTOR_7 ((uint32_t)7U) 415 #define FLASH_SECTOR_8 ((uint32_t)8U) 416 #define FLASH_SECTOR_9 ((uint32_t)9U) 417 #define FLASH_SECTOR_10 ((uint32_t)10U) 418 #define FLASH_SECTOR_11 ((uint32_t)11U) 423 #if defined(STM32F401xC) 424 #define FLASH_SECTOR_0 ((uint32_t)0U) 425 #define FLASH_SECTOR_1 ((uint32_t)1U) 426 #define FLASH_SECTOR_2 ((uint32_t)2U) 427 #define FLASH_SECTOR_3 ((uint32_t)3U) 428 #define FLASH_SECTOR_4 ((uint32_t)4U) 429 #define FLASH_SECTOR_5 ((uint32_t)5U) 434 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 435 #define FLASH_SECTOR_0 ((uint32_t)0U) 436 #define FLASH_SECTOR_1 ((uint32_t)1U) 437 #define FLASH_SECTOR_2 ((uint32_t)2U) 438 #define FLASH_SECTOR_3 ((uint32_t)3U) 439 #define FLASH_SECTOR_4 ((uint32_t)4U) 444 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) 445 #define FLASH_SECTOR_0 ((uint32_t)0U) 446 #define FLASH_SECTOR_1 ((uint32_t)1U) 447 #define FLASH_SECTOR_2 ((uint32_t)2U) 448 #define FLASH_SECTOR_3 ((uint32_t)3U) 449 #define FLASH_SECTOR_4 ((uint32_t)4U) 450 #define FLASH_SECTOR_5 ((uint32_t)5U) 451 #define FLASH_SECTOR_6 ((uint32_t)6U) 452 #define FLASH_SECTOR_7 ((uint32_t)7U) 464 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 465 defined(STM32F469xx) || defined(STM32F479xx) 466 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001U) 467 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002U) 468 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004U) 469 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008U) 470 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010U) 471 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020U) 472 #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040U) 473 #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080U) 474 #define OB_WRP_SECTOR_8 ((uint32_t)0x00000100U) 475 #define OB_WRP_SECTOR_9 ((uint32_t)0x00000200U) 476 #define OB_WRP_SECTOR_10 ((uint32_t)0x00000400U) 477 #define OB_WRP_SECTOR_11 ((uint32_t)0x00000800U) 478 #define OB_WRP_SECTOR_12 ((uint32_t)0x00000001U << 12) 479 #define OB_WRP_SECTOR_13 ((uint32_t)0x00000002U << 12) 480 #define OB_WRP_SECTOR_14 ((uint32_t)0x00000004U << 12) 481 #define OB_WRP_SECTOR_15 ((uint32_t)0x00000008U << 12) 482 #define OB_WRP_SECTOR_16 ((uint32_t)0x00000010U << 12) 483 #define OB_WRP_SECTOR_17 ((uint32_t)0x00000020U << 12) 484 #define OB_WRP_SECTOR_18 ((uint32_t)0x00000040U << 12) 485 #define OB_WRP_SECTOR_19 ((uint32_t)0x00000080U << 12) 486 #define OB_WRP_SECTOR_20 ((uint32_t)0x00000100U << 12) 487 #define OB_WRP_SECTOR_21 ((uint32_t)0x00000200U << 12) 488 #define OB_WRP_SECTOR_22 ((uint32_t)0x00000400U << 12) 489 #define OB_WRP_SECTOR_23 ((uint32_t)0x00000800U << 12) 490 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFFU << 12) 495 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ 496 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 497 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001U) 498 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002U) 499 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004U) 500 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008U) 501 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010U) 502 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020U) 503 #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040U) 504 #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080U) 505 #define OB_WRP_SECTOR_8 ((uint32_t)0x00000100U) 506 #define OB_WRP_SECTOR_9 ((uint32_t)0x00000200U) 507 #define OB_WRP_SECTOR_10 ((uint32_t)0x00000400U) 508 #define OB_WRP_SECTOR_11 ((uint32_t)0x00000800U) 509 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFFU) 514 #if defined(STM32F401xC) 515 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001U) 516 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002U) 517 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004U) 518 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008U) 519 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010U) 520 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020U) 521 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFFU) 526 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 527 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001U) 528 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002U) 529 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004U) 530 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008U) 531 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010U) 532 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFFU) 537 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) 538 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001U) 539 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002U) 540 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004U) 541 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008U) 542 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010U) 543 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020U) 544 #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040U) 545 #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080U) 546 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFFU) 557 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 558 defined(STM32F469xx) || defined(STM32F479xx) 559 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001U) 560 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002U) 561 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004U) 562 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008U) 563 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010U) 564 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020U) 565 #define OB_PCROP_SECTOR_6 ((uint32_t)0x00000040U) 566 #define OB_PCROP_SECTOR_7 ((uint32_t)0x00000080U) 567 #define OB_PCROP_SECTOR_8 ((uint32_t)0x00000100U) 568 #define OB_PCROP_SECTOR_9 ((uint32_t)0x00000200U) 569 #define OB_PCROP_SECTOR_10 ((uint32_t)0x00000400U) 570 #define OB_PCROP_SECTOR_11 ((uint32_t)0x00000800U) 571 #define OB_PCROP_SECTOR_12 ((uint32_t)0x00000001U) 572 #define OB_PCROP_SECTOR_13 ((uint32_t)0x00000002U) 573 #define OB_PCROP_SECTOR_14 ((uint32_t)0x00000004U) 574 #define OB_PCROP_SECTOR_15 ((uint32_t)0x00000008U) 575 #define OB_PCROP_SECTOR_16 ((uint32_t)0x00000010U) 576 #define OB_PCROP_SECTOR_17 ((uint32_t)0x00000020U) 577 #define OB_PCROP_SECTOR_18 ((uint32_t)0x00000040U) 578 #define OB_PCROP_SECTOR_19 ((uint32_t)0x00000080U) 579 #define OB_PCROP_SECTOR_20 ((uint32_t)0x00000100U) 580 #define OB_PCROP_SECTOR_21 ((uint32_t)0x00000200U) 581 #define OB_PCROP_SECTOR_22 ((uint32_t)0x00000400U) 582 #define OB_PCROP_SECTOR_23 ((uint32_t)0x00000800U) 583 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFFU) 588 #if defined(STM32F401xC) 589 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001U) 590 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002U) 591 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004U) 592 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008U) 593 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010U) 594 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020U) 595 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFFU) 600 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 601 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001U) 602 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002U) 603 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004U) 604 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008U) 605 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010U) 606 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFFU) 611 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 612 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 613 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001U) 614 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002U) 615 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004U) 616 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008U) 617 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010U) 618 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020U) 619 #define OB_PCROP_SECTOR_6 ((uint32_t)0x00000040U) 620 #define OB_PCROP_SECTOR_7 ((uint32_t)0x00000080U) 621 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFFU) 632 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 633 defined(STM32F469xx) || defined(STM32F479xx) 634 #define OB_DUAL_BOOT_ENABLE ((uint8_t)0x10U) 635 #define OB_DUAL_BOOT_DISABLE ((uint8_t)0x00U) 644 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 645 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 646 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 647 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 649 #define OB_PCROP_DESELECTED ((uint8_t)0x00U) 650 #define OB_PCROP_SELECTED ((uint8_t)0x80U) 678 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 679 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 680 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 681 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 683 HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
684 void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
691 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 692 defined(STM32F469xx) || defined(STM32F479xx) 693 uint16_t HAL_FLASHEx_OB_GetBank2WRP(
void);
709 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 710 #define FLASH_SECTOR_TOTAL 24U 714 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ 715 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 716 #define FLASH_SECTOR_TOTAL 12U 720 #if defined(STM32F401xC) 721 #define FLASH_SECTOR_TOTAL 6U 725 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 726 #define FLASH_SECTOR_TOTAL 5U 730 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) 731 #define FLASH_SECTOR_TOTAL 8U 737 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 738 #define OPTCR1_BYTE2_ADDRESS ((uint32_t)0x40023C1AU) 754 #define IS_FLASH_TYPEERASE(VALUE)(((VALUE) == FLASH_TYPEERASE_SECTORS) || \ 755 ((VALUE) == FLASH_TYPEERASE_MASSERASE)) 757 #define IS_VOLTAGERANGE(RANGE)(((RANGE) == FLASH_VOLTAGE_RANGE_1) || \ 758 ((RANGE) == FLASH_VOLTAGE_RANGE_2) || \ 759 ((RANGE) == FLASH_VOLTAGE_RANGE_3) || \ 760 ((RANGE) == FLASH_VOLTAGE_RANGE_4)) 762 #define IS_WRPSTATE(VALUE)(((VALUE) == OB_WRPSTATE_DISABLE) || \ 763 ((VALUE) == OB_WRPSTATE_ENABLE)) 765 #define IS_OPTIONBYTE(VALUE)(((VALUE) <= (OPTIONBYTE_WRP|OPTIONBYTE_RDP|OPTIONBYTE_USER|OPTIONBYTE_BOR))) 767 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\ 768 ((LEVEL) == OB_RDP_LEVEL_1) ||\ 769 ((LEVEL) == OB_RDP_LEVEL_2)) 771 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW)) 773 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST)) 775 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST)) 777 #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL1) || ((LEVEL) == OB_BOR_LEVEL2) ||\ 778 ((LEVEL) == OB_BOR_LEVEL3) || ((LEVEL) == OB_BOR_OFF)) 780 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 781 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 782 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 783 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 785 #define IS_PCROPSTATE(VALUE)(((VALUE) == OB_PCROP_STATE_DISABLE) || \ 786 ((VALUE) == OB_PCROP_STATE_ENABLE)) 791 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 792 defined(STM32F469xx) || defined(STM32F479xx) 793 #define IS_OBEX(VALUE)(((VALUE) == OPTIONBYTE_PCROP) || \ 794 ((VALUE) == OPTIONBYTE_BOOTCONFIG)) 797 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 798 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 799 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 800 #define IS_OBEX(VALUE)(((VALUE) == OPTIONBYTE_PCROP)) 804 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 805 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) 806 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \ 807 ((LATENCY) == FLASH_LATENCY_1) || \ 808 ((LATENCY) == FLASH_LATENCY_2) || \ 809 ((LATENCY) == FLASH_LATENCY_3) || \ 810 ((LATENCY) == FLASH_LATENCY_4) || \ 811 ((LATENCY) == FLASH_LATENCY_5) || \ 812 ((LATENCY) == FLASH_LATENCY_6) || \ 813 ((LATENCY) == FLASH_LATENCY_7) || \ 814 ((LATENCY) == FLASH_LATENCY_8) || \ 815 ((LATENCY) == FLASH_LATENCY_9) || \ 816 ((LATENCY) == FLASH_LATENCY_10) || \ 817 ((LATENCY) == FLASH_LATENCY_11) || \ 818 ((LATENCY) == FLASH_LATENCY_12) || \ 819 ((LATENCY) == FLASH_LATENCY_13) || \ 820 ((LATENCY) == FLASH_LATENCY_14) || \ 821 ((LATENCY) == FLASH_LATENCY_15)) 824 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ 825 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 826 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ 827 defined(STM32F412Rx) || defined(STM32F412Cx) 828 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \ 829 ((LATENCY) == FLASH_LATENCY_1) || \ 830 ((LATENCY) == FLASH_LATENCY_2) || \ 831 ((LATENCY) == FLASH_LATENCY_3) || \ 832 ((LATENCY) == FLASH_LATENCY_4) || \ 833 ((LATENCY) == FLASH_LATENCY_5) || \ 834 ((LATENCY) == FLASH_LATENCY_6) || \ 835 ((LATENCY) == FLASH_LATENCY_7)) 839 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 840 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \ 841 ((BANK) == FLASH_BANK_2) || \ 842 ((BANK) == FLASH_BANK_BOTH)) 845 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ 846 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 847 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 848 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 849 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1)) 853 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 854 #define IS_FLASH_SECTOR(SECTOR) ( ((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 855 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 856 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\ 857 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\ 858 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\ 859 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11) ||\ 860 ((SECTOR) == FLASH_SECTOR_12) || ((SECTOR) == FLASH_SECTOR_13) ||\ 861 ((SECTOR) == FLASH_SECTOR_14) || ((SECTOR) == FLASH_SECTOR_15) ||\ 862 ((SECTOR) == FLASH_SECTOR_16) || ((SECTOR) == FLASH_SECTOR_17) ||\ 863 ((SECTOR) == FLASH_SECTOR_18) || ((SECTOR) == FLASH_SECTOR_19) ||\ 864 ((SECTOR) == FLASH_SECTOR_20) || ((SECTOR) == FLASH_SECTOR_21) ||\ 865 ((SECTOR) == FLASH_SECTOR_22) || ((SECTOR) == FLASH_SECTOR_23)) 868 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ 869 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 870 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 871 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 872 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\ 873 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\ 874 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\ 875 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11)) 878 #if defined(STM32F401xC) 879 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 880 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 881 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5)) 884 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 885 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 886 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 887 ((SECTOR) == FLASH_SECTOR_4)) 890 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) 891 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 892 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 893 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\ 894 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7)) 897 #define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_END)) 898 #define IS_FLASH_NBSECTORS(NBSECTORS) (((NBSECTORS) != 0) && ((NBSECTORS) <= FLASH_SECTOR_TOTAL)) 900 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 901 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFF000000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 904 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) 905 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 908 #if defined(STM32F401xC) 909 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 912 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 913 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 916 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ 917 defined(STM32F412Rx) || defined(STM32F412Cx) 918 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 921 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 922 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 925 #if defined(STM32F401xC) 926 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 929 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 930 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 933 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ 934 defined(STM32F412Rx) || defined(STM32F412Cx) 935 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 938 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 939 defined(STM32F469xx) || defined(STM32F479xx) 940 #define IS_OB_BOOT(BOOT) (((BOOT) == OB_DUAL_BOOT_ENABLE) || ((BOOT) == OB_DUAL_BOOT_DISABLE)) 943 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 944 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 945 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 946 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 948 #define IS_OB_PCROP_SELECT(PCROP) (((PCROP) == OB_PCROP_SELECTED) || ((PCROP) == OB_PCROP_DESELECTED)) 964 void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange);
965 void FLASH_FlushCaches(
void);
FLASH Erase structure definition.
Definition: stm32f4xx_hal_flash_ex.h:65
uint32_t TypeErase
Definition: stm32f4xx_hal_flash_ex.h:67
This file contains HAL common defines, enumeration, macros and structures definitions.
uint32_t WRPState
Definition: stm32f4xx_hal_flash_ex.h:92
uint32_t BORLevel
Definition: stm32f4xx_hal_flash_ex.h:104
uint32_t VoltageRange
Definition: stm32f4xx_hal_flash_ex.h:79
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32f4xx_hal_def.h:57
uint32_t NbSectors
Definition: stm32f4xx_hal_flash_ex.h:76
uint8_t USERConfig
Definition: stm32f4xx_hal_flash_ex.h:107
uint32_t RDPLevel
Definition: stm32f4xx_hal_flash_ex.h:101
FLASH Option Bytes Program structure definition.
Definition: stm32f4xx_hal_flash_ex.h:87
uint32_t Banks
Definition: stm32f4xx_hal_flash_ex.h:98
uint32_t WRPSector
Definition: stm32f4xx_hal_flash_ex.h:95
uint32_t Banks
Definition: stm32f4xx_hal_flash_ex.h:70
uint32_t OptionType
Definition: stm32f4xx_hal_flash_ex.h:89
uint32_t Sector
Definition: stm32f4xx_hal_flash_ex.h:73