FlashDev.c 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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 PY067xx_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. #endif // PY067xx_8
  49. #ifdef PY067xx_16
  50. struct FlashDevice const FlashDevice =
  51. {
  52. FLASH_DRV_VERS, // Driver Version, do not modify!
  53. "Cortex-M0+ 16kB Flash", // Device Name (16kB)
  54. ONCHIP, // Device Type
  55. 0x08000000, // Device Start Address
  56. 0x00004000, // Device Size in Bytes (16kB)
  57. 0x80, // 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. 0x1000, 0x000000, // Sector Size 4kB (4 sectors)
  64. SECTOR_END};
  65. #endif // PY067xx_16
  66. #ifdef PY067xx_20
  67. struct FlashDevice const FlashDevice =
  68. {
  69. FLASH_DRV_VERS, // Driver Version, do not modify!
  70. "Cortex-M0+ 20kB Flash", // Device Name (20kB)
  71. ONCHIP, // Device Type
  72. 0x08000000, // Device Start Address
  73. 0x00005000, // Device Size in Bytes (20kB)
  74. 0x80, // 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. 0x1000, 0x000000, // Sector Size 4kB (5 sectors)
  81. SECTOR_END};
  82. #endif // PY067xx_20
  83. #ifdef PY067xx_32
  84. struct FlashDevice const FlashDevice =
  85. {
  86. FLASH_DRV_VERS, // Driver Version, do not modify!
  87. "Cortex-M0+ 32kB Flash", // Device Name (32kB)
  88. ONCHIP, // Device Type
  89. 0x08000000, // Device Start Address
  90. 0x00008000, // Device Size in Bytes (32kB)
  91. 0x80, // 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. 0x1000, 0x000000, // Sector Size 4kB (8 sectors)
  98. SECTOR_END};
  99. #endif // PY067xx_32
  100. #ifdef PY067xx_48
  101. struct FlashDevice const FlashDevice =
  102. {
  103. FLASH_DRV_VERS, // Driver Version, do not modify!
  104. "Cortex-M0+ 48kB Flash", // Device Name (48kB)
  105. ONCHIP, // Device Type
  106. 0x08000000, // Device Start Address
  107. 0x0000C000, // Device Size in Bytes (48kB)
  108. 0x80, // Programming Page Size
  109. 0, // Reserved, must be 0
  110. 0xFF, // Initial Content of Erased Memory
  111. 600, // Program Page Timeout 600 mSec
  112. 6000, // Erase Sector Timeout 6000 mSec
  113. // Specify Size and Address of Sectors
  114. 0x1000, 0x000000, // Sector Size 4kB (12 sectors)
  115. SECTOR_END};
  116. #endif // PY067xx_48
  117. #ifdef PY067xx_64
  118. struct FlashDevice const FlashDevice =
  119. {
  120. FLASH_DRV_VERS, // Driver Version, do not modify!
  121. "Cortex-M0+ 64kB Flash", // Device Name (64kB)
  122. ONCHIP, // Device Type
  123. 0x08000000, // Device Start Address
  124. 0x00010000, // Device Size in Bytes (64kB)
  125. 0x80, // Programming Page Size
  126. 0, // Reserved, must be 0
  127. 0xFF, // Initial Content of Erased Memory
  128. 600, // Program Page Timeout 600 mSec
  129. 6000, // Erase Sector Timeout 6000 mSec
  130. // Specify Size and Address of Sectors
  131. 0x1000, 0x000000, // Sector Size 4kB (16 sectors)
  132. SECTOR_END};
  133. #endif // PY067xx_64
  134. #endif // FLASH_MEM
  135. #ifdef FLASH_PE
  136. #ifdef PY067xx_64_PE
  137. struct FlashDevice const FlashDevice =
  138. {
  139. FLASH_DRV_VERS, // Driver Version, do not modify!
  140. "Cortex-M0+ 64kB Flash", // Device Name (64kB)
  141. ONCHIP, // Device Type
  142. 0x08000000, // Device Start Address
  143. 0x00010000, // Device Size in Bytes (64kB)
  144. 0x80, // Programming Page Size
  145. 0, // Reserved, must be 0
  146. 0xFF, // Initial Content of Erased Memory
  147. 600, // Program Page Timeout 600 mSec
  148. 6000, // Erase Sector Timeout 6000 mSec
  149. // Specify Size and Address of Sectors(Actual page size)
  150. 0x80, 0x000000, // Sector Size 4kB (Actual page size)
  151. SECTOR_END};
  152. #endif // PY067xx_64_PE
  153. #endif // FLASH_PE
  154. #ifdef FLASH_OB
  155. struct FlashDevice const FlashDevice =
  156. {
  157. FLASH_DRV_VERS, // Driver Version, do not modify!
  158. "Cortex-M0+ Flash Options", // Device Name
  159. ONCHIP, // Device Type
  160. 0x1FFF0E80, // Device Start Address
  161. 0x00000010, // Device Size in Bytes (16)
  162. 0x10, // Programming Page Size
  163. 0, // Reserved, must be 0
  164. 0xFF, // Initial Content of Erased Memory
  165. 3000, // Program Page Timeout 3 Sec
  166. 3000, // Erase Sector Timeout 3 Sec
  167. // Specify Size and Address of Sectors
  168. 0x00010, 0x000000, // Sector Size 16B (1 sectors)
  169. SECTOR_END};
  170. #endif // FLASH_OB
  171. #ifdef FLASH_OTP
  172. struct FlashDevice const FlashDevice =
  173. {
  174. FLASH_DRV_VERS, // Driver Version, do not modify!
  175. "Cortex-M0+ Flash User Data ", // Device Name
  176. ONCHIP, // Device Type
  177. 0x1FFF0D00, // Device Start Address
  178. 0x00000080, // Device Size in Bytes (128)
  179. 0x80, // Programming Page Size
  180. 0, // Reserved, must be 0
  181. 0xFF, // Initial Content of Erased Memory
  182. 3000, // Program Page Timeout 3 Sec
  183. 3000, // Erase Sector Timeout 3 Sec
  184. // Specify Size and Address of Sectors
  185. 0x00080, 0x000000, // Sector Size 128B (1 sectors)
  186. SECTOR_END};
  187. #endif // FLASH_OTP