FlashDev.c 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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 PY32T020xx 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 PY068xx_12
  33. struct FlashDevice const FlashDevice =
  34. {
  35. FLASH_DRV_VERS, // Driver Version, do not modify!
  36. "Cortex-M0+ 12kB Flash", // Device Name (20kB)
  37. ONCHIP, // Device Type
  38. 0x08000000, // Device Start Address
  39. 0x00003000, // Device Size in Bytes (32kB)
  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 (6 sectors)
  47. SECTOR_END};
  48. #endif // PY068xx_16
  49. #ifdef PY068xx_16
  50. struct FlashDevice const FlashDevice =
  51. {
  52. FLASH_DRV_VERS, // Driver Version, do not modify!
  53. "Cortex-M0+ 16kB Flash", // Device Name (20kB)
  54. ONCHIP, // Device Type
  55. 0x08000000, // Device Start Address
  56. 0x00004000, // Device Size in Bytes (32kB)
  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 (6 sectors)
  64. SECTOR_END};
  65. #endif // PY068xx_16
  66. #ifdef PY068xx_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 (32kB)
  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 (6 sectors)
  81. SECTOR_END};
  82. #endif // PY068xx_20
  83. #ifdef PY068xx_24
  84. struct FlashDevice const FlashDevice =
  85. {
  86. FLASH_DRV_VERS, // Driver Version, do not modify!
  87. "Cortex-M0+ 24kB Flash", // Device Name (20kB)
  88. ONCHIP, // Device Type
  89. 0x08000000, // Device Start Address
  90. 0x00006000, // 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 (6 sectors)
  98. SECTOR_END};
  99. #endif // PY068xx_24
  100. #ifdef PY068xx_32
  101. struct FlashDevice const FlashDevice =
  102. {
  103. FLASH_DRV_VERS, // Driver Version, do not modify!
  104. "Cortex-M0+ 32kB Flash", // Device Name (32kB)
  105. ONCHIP, // Device Type
  106. 0x08000000, // Device Start Address
  107. 0x00008000, // Device Size in Bytes (32kB)
  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 (6 sectors)
  115. SECTOR_END};
  116. #endif // PY068xx_32
  117. #ifdef FLASH_OTP
  118. struct FlashDevice const FlashDevice =
  119. {
  120. FLASH_DRV_VERS, // Driver Version, do not modify!
  121. "Cortex-M0+ OTP", // Device Name
  122. ONCHIP, // Device Type
  123. 0x1FFF0280, // Device Start Address
  124. 0x00000080, // Device Size in Bytes (128)
  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. 0x0080, 0x000000, // Sector Size 128B (1 sectors)
  132. SECTOR_END};
  133. #endif // FLASH_OTP
  134. #endif // FLASH_MEM
  135. #ifdef FLASH_OB
  136. struct FlashDevice const FlashDevice =
  137. {
  138. FLASH_DRV_VERS, // Driver Version, do not modify!
  139. "Cortex-M0+ Flash Options", // Device Name
  140. ONCHIP, // Device Type
  141. 0x1FFF0080, // Device Start Address
  142. 0x00000010, // Device Size in Bytes (16)
  143. 0x10, // Programming Page Size
  144. 0, // Reserved, must be 0
  145. 0xFF, // Initial Content of Erased Memory
  146. 3000, // Program Page Timeout 3 Sec
  147. 3000, // Erase Sector Timeout 3 Sec
  148. // Specify Size and Address of Sectors
  149. 0x0010, 0x000000, // Sector Size 16B (1 sectors)
  150. SECTOR_END};
  151. #endif // PY068xx_OB