FlashDev.c 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 PY32F0xx 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 PY061xx_8
  33. struct FlashDevice const FlashDevice =
  34. {
  35. FLASH_DRV_VERS, // Driver Version, do not modify!
  36. "Cortex-M0+ 8kB Flash", // Device Name (8kB)
  37. ONCHIP, // Device Type
  38. 0x08000000, // Device Start Address
  39. 0x00002000, // Device Size in Bytes (8kB)
  40. 0x80, // 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. 0x1000, 0x000000, // Sector Size 4kB (2 sectors)
  47. SECTOR_END
  48. };
  49. #endif // PY061xx_8
  50. #ifdef PY061xx_16
  51. struct FlashDevice const FlashDevice =
  52. {
  53. FLASH_DRV_VERS, // Driver Version, do not modify!
  54. "Cortex-M0+ 16kB Flash", // Device Name (16kB)
  55. ONCHIP, // Device Type
  56. 0x08000000, // Device Start Address
  57. 0x00004000, // Device Size in Bytes (16kB)
  58. 0x80, // Programming Page Size
  59. 0, // Reserved, must be 0
  60. 0xFF, // Initial Content of Erased Memory
  61. 600, // Program Page Timeout 600 mSec
  62. 6000, // Erase Sector Timeout 6000 mSec
  63. // Specify Size and Address of Sectors
  64. 0x1000, 0x000000, // Sector Size 4kB (4 sectors)
  65. SECTOR_END
  66. };
  67. #endif // PY061xx_16
  68. #ifdef PY061xx_20
  69. struct FlashDevice const FlashDevice =
  70. {
  71. FLASH_DRV_VERS, // Driver Version, do not modify!
  72. "Cortex-M0+ 20kB Flash", // Device Name (20kB)
  73. ONCHIP, // Device Type
  74. 0x08000000, // Device Start Address
  75. 0x00005000, // Device Size in Bytes (20kB)
  76. 0x80, // Programming Page Size
  77. 0, // Reserved, must be 0
  78. 0xFF, // Initial Content of Erased Memory
  79. 600, // Program Page Timeout 600 mSec
  80. 6000, // Erase Sector Timeout 6000 mSec
  81. // Specify Size and Address of Sectors
  82. 0x1000, 0x000000, // Sector Size 4kB (5 sectors)
  83. SECTOR_END
  84. };
  85. #endif // PY061xx_20
  86. #ifdef PY061xx_24
  87. struct FlashDevice const FlashDevice =
  88. {
  89. FLASH_DRV_VERS, // Driver Version, do not modify!
  90. "Cortex-M0+ 24kB Flash", // Device Name (24kB)
  91. ONCHIP, // Device Type
  92. 0x08000000, // Device Start Address
  93. 0x00006000, // Device Size in Bytes (24kB)
  94. 0x80, // Programming Page Size
  95. 0, // Reserved, must be 0
  96. 0xFF, // Initial Content of Erased Memory
  97. 600, // Program Page Timeout 600 mSec
  98. 6000, // Erase Sector Timeout 6000 mSec
  99. // Specify Size and Address of Sectors
  100. 0x1000, 0x000000, // Sector Size 4kB (6 sectors)
  101. SECTOR_END
  102. };
  103. #endif // PY061xx_24
  104. #ifdef PY061xx_32
  105. struct FlashDevice const FlashDevice =
  106. {
  107. FLASH_DRV_VERS, // Driver Version, do not modify!
  108. "Cortex-M0+ 32kB Flash", // Device Name (32kB)
  109. ONCHIP, // Device Type
  110. 0x08000000, // Device Start Address
  111. 0x00008000, // Device Size in Bytes (32kB)
  112. 0x80, // Programming Page Size
  113. 0, // Reserved, must be 0
  114. 0xFF, // Initial Content of Erased Memory
  115. 600, // Program Page Timeout 600 mSec
  116. 6000, // Erase Sector Timeout 6000 mSec
  117. // Specify Size and Address of Sectors
  118. 0x1000, 0x000000, // Sector Size 4kB (8 sectors)
  119. SECTOR_END
  120. };
  121. #endif // PY061xx_32
  122. #ifdef PY061xx_48
  123. struct FlashDevice const FlashDevice =
  124. {
  125. FLASH_DRV_VERS, // Driver Version, do not modify!
  126. "Cortex-M0+ 48kB Flash", // Device Name (48kB)
  127. ONCHIP, // Device Type
  128. 0x08000000, // Device Start Address
  129. 0x0000C000, // Device Size in Bytes (48kB)
  130. 0x80, // Programming Page Size
  131. 0, // Reserved, must be 0
  132. 0xFF, // Initial Content of Erased Memory
  133. 600, // Program Page Timeout 600 mSec
  134. 6000, // Erase Sector Timeout 6000 mSec
  135. // Specify Size and Address of Sectors
  136. 0x1000, 0x000000, // Sector Size 4kB (12 sectors)
  137. SECTOR_END
  138. };
  139. #endif // PY061xx_48
  140. #ifdef PY061xx_64
  141. struct FlashDevice const FlashDevice =
  142. {
  143. FLASH_DRV_VERS, // Driver Version, do not modify!
  144. "Cortex-M0+ 64kB Flash", // Device Name (64kB)
  145. ONCHIP, // Device Type
  146. 0x08000000, // Device Start Address
  147. 0x00010000, // Device Size in Bytes (64kB)
  148. 0x80, // Programming Page Size
  149. 0, // Reserved, must be 0
  150. 0xFF, // Initial Content of Erased Memory
  151. 600, // Program Page Timeout 600 mSec
  152. 6000, // Erase Sector Timeout 6000 mSec
  153. // Specify Size and Address of Sectors
  154. 0x1000, 0x000000, // Sector Size 4kB (16 sectors)
  155. SECTOR_END
  156. };
  157. #endif // PY061xx_64
  158. #endif // FLASH_MEM
  159. #ifdef FLASH_OB
  160. struct FlashDevice const FlashDevice =
  161. {
  162. FLASH_DRV_VERS, // Driver Version, do not modify!
  163. "Cortex-M0+ Flash Options", // Device Name
  164. ONCHIP, // Device Type
  165. 0x1FFF0E80, // Device Start Address
  166. 0x00000010, // Device Size in Bytes (16)
  167. 0x10, // Programming Page Size
  168. 0, // Reserved, must be 0
  169. 0xFF, // Initial Content of Erased Memory
  170. 3000, // Program Page Timeout 3 Sec
  171. 3000, // Erase Sector Timeout 3 Sec
  172. // Specify Size and Address of Sectors
  173. 0x00010, 0x000000, // Sector Size 16B (1 sectors)
  174. SECTOR_END
  175. };
  176. #endif // FLASH_OB