FlashDev.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* -----------------------------------------------------------------------------
  2. * Copyright (c) 2014 - 2019 ARM Ltd.
  3. *
  4. * This software is provided 'as-is', without any express or implied warranty.
  5. * In no event will the authors be held liable for any damages arising from
  6. * the use of this software. Permission is granted to anyone to use this
  7. * software for any purpose, including commercial applications, and to alter
  8. * it and redistribute it freely, subject to the following restrictions:
  9. *
  10. * 1. The origin of this software must not be misrepresented; you must not
  11. * claim that you wrote the original software. If you use this software in
  12. * a product, an acknowledgment in the product documentation would be
  13. * appreciated but is not required.
  14. *
  15. * 2. Altered source versions must be plainly marked as such, and must not be
  16. * misrepresented as being the original software.
  17. *
  18. * 3. This notice may not be removed or altered from any source distribution.
  19. *
  20. *
  21. * $Date: 2021-7-1
  22. * $Revision: V1.0.0
  23. *
  24. * Project: Flash Device Description for Puya PY32F030xx Flash
  25. * --------------------------------------------------------------------------- */
  26. /* History:
  27. * Version 1.0.0
  28. * Initial release
  29. */
  30. #include "FlashOS.h" // FlashOS Structures
  31. #ifdef FLASH_MEM
  32. #ifdef PY088xx_64
  33. struct FlashDevice const FlashDevice =
  34. {
  35. FLASH_DRV_VERS, // Driver Version, do not modify!
  36. "Cortex-M0+ 64kB Flash", // Device Name (64kB)
  37. ONCHIP, // Device Type
  38. 0x08000000, // Device Start Address
  39. 0x00010000, // Device Size in Bytes (128kB)
  40. 0x100, // Programming Page Size
  41. 0, // Reserved, must be 0
  42. 0xFF, // Initial Content of Erased Memory
  43. 600, // Program Page Timeout 600 mSec
  44. 6000, // Erase Sector Timeout 6000 mSec
  45. // Specify Size and Address of Sectors
  46. 0x2000, 0x000000, // Sector Size 4kB (2 sectors)
  47. SECTOR_END};
  48. #endif // PY088xx_64
  49. #ifdef PY088xx_96
  50. struct FlashDevice const FlashDevice =
  51. {
  52. FLASH_DRV_VERS, // Driver Version, do not modify!
  53. "Cortex-M0+ 96kB Flash", // Device Name (96kB)
  54. ONCHIP, // Device Type
  55. 0x08000000, // Device Start Address
  56. 0x00018000, // Device Size in Bytes (128kB)
  57. 0x100, // Programming Page Size
  58. 0, // Reserved, must be 0
  59. 0xFF, // Initial Content of Erased Memory
  60. 600, // Program Page Timeout 600 mSec
  61. 6000, // Erase Sector Timeout 6000 mSec
  62. // Specify Size and Address of Sectors
  63. 0x2000, 0x000000, // Sector Size 4kB (2 sectors)
  64. SECTOR_END};
  65. #endif // PY088xx_96
  66. #ifdef PY088xx_128
  67. struct FlashDevice const FlashDevice =
  68. {
  69. FLASH_DRV_VERS, // Driver Version, do not modify!
  70. "Cortex-M0+ 128kB Flash", // Device Name (128kB)
  71. ONCHIP, // Device Type
  72. 0x08000000, // Device Start Address
  73. 0x00020000, // Device Size in Bytes (128kB)
  74. 0x100, // Programming Page Size
  75. 0, // Reserved, must be 0
  76. 0xFF, // Initial Content of Erased Memory
  77. 600, // Program Page Timeout 600 mSec
  78. 6000, // Erase Sector Timeout 6000 mSec
  79. // Specify Size and Address of Sectors
  80. 0x2000, 0x000000, // Sector Size 4kB (2 sectors)
  81. SECTOR_END};
  82. #endif // PY088xx_128
  83. #ifdef PY088xx_256
  84. struct FlashDevice const FlashDevice =
  85. {
  86. FLASH_DRV_VERS, // Driver Version, do not modify!
  87. "Cortex-M0+ 256kB Flash", // Device Name (256kB)
  88. ONCHIP, // Device Type
  89. 0x08000000, // Device Start Address
  90. 0x00040000, // Device Size in Bytes (256kB)
  91. 0x100, // Programming Page Size
  92. 0, // Reserved, must be 0
  93. 0xFF, // Initial Content of Erased Memory
  94. 600, // Program Page Timeout 600 mSec
  95. 6000, // Erase Sector Timeout 6000 mSec
  96. // Specify Size and Address of Sectors
  97. 0x2000, 0x000000, // Sector Size 8kB (2 sectors)
  98. SECTOR_END};
  99. #endif // PY088xx_256
  100. #endif // FLASH_MEM
  101. #ifdef FLASH_OTP
  102. struct FlashDevice const FlashDevice =
  103. {
  104. FLASH_DRV_VERS, // Driver Version, do not modify!
  105. "Cortex-M0+ OTP Flash", // Device Name
  106. ONCHIP, // Device Type
  107. 0x1FFF1A00, // Device Start Address
  108. 0x00000100, // Device Size in Bytes (256)
  109. 0x100, // Programming Page Size
  110. 0, // Reserved, must be 0
  111. 0xFF, // Initial Content of Erased Memory
  112. 3000, // Program Page Timeout 3 Sec
  113. 3000, // Erase Sector Timeout 3 Sec
  114. // Specify Size and Address of Sectors
  115. 0x00100, 0x000000, // Sector Size 32B (1 sectors)
  116. SECTOR_END};
  117. #endif // FLASH_OTP
  118. #ifdef FLASH_OB
  119. struct FlashDevice const FlashDevice =
  120. {
  121. FLASH_DRV_VERS, // Driver Version, do not modify!
  122. "Cortex-M0+ Flash Options", // Device Name
  123. ONCHIP, // Device Type
  124. 0x1FFF1D00, // Device Start Address
  125. 0x00000040, // Device Size in Bytes (32)
  126. 0x40, // Programming Page Size
  127. 0, // Reserved, must be 0
  128. 0xFF, // Initial Content of Erased Memory
  129. 3000, // Program Page Timeout 3 Sec
  130. 3000, // Erase Sector Timeout 3 Sec
  131. // Specify Size and Address of Sectors
  132. 0x00040, 0x000000, // Sector Size 32B (1 sectors)
  133. SECTOR_END};
  134. #endif // FLASH_OB