NetBurner 3.1
SSL/VerifyPeerEffs/src/flashChip/SAME70Q21.h
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
5 
6 /*-------------------------------------------------------------------
7  * EFFS-STD configuration file for MicroChip SAME70Q21 Flash Chip.
8  * This file is part of an example that allocates 512K of flash space
9  * to the file system, and the rest to the application.
10  *-----------------------------------------------------------------*/
11 
12 #ifndef _ONCHIPFLASH_H_
13 #define _ONCHIPFLASH_H_
14 
15 #include "file/fsf.h"
16 #include "basictypes.h"
17 #include "hal.h"
18 
19 
20 #define FLASH_NAME "SAME70Q21"
21 
22 /*functions implemented*/
23 extern int fs_phy_OnChipFlash( FS_FLASH *flash );
24 
25 
26 // Start of Flash memory base address
27 #define FS_FLASHBASE (0x00400000)
28 
29 /*
30  * BLOCKSIZE
31  * This defines the size of the blocks to be used in the file storage area.
32  * This must be an erasable unit of the flash chip. All blocks in the file
33  * storage area must be the same size. This maybe different from the DESCSIZE
34  * where the flash chip has different size erasable units available.
35  *
36  * SECTORSIZE
37  * This defines the sector size. Each block is divided into a number of sectors.
38  * This number is the smallest usable unit in the system and thus represents the
39  * minimum file storage area. For best usage of the flash blocks the sector size
40  * should always be a power of 2. For more information see sector section below.
41  *
42  * SECTORPERBLOCK
43  * This defines the number of sectors in a block. It must always be true that:
44  * SECTORPERBLOCK = BLOCKSIZE/SECTORSIZE
45  *
46  *
47  * The memory map below is for a MODM7AE70 with a 2MB bottom boot block flash.
48  * This example will allocate 1.5MB for the application space, and 512KB for
49  * the file system.
50  *
51  * Microchip SAME70Q21:
52  * The memory is organized in sectors. Each sector has a size of 128 Kbytes. The
53  * first sector is divided into 3 smaller sectors. The three smaller sectors are
54  * organized in 2 sectors of 8 Kbytes and 1 sector of 112 Kbytes.
55  * Total number of bytes for storage: 2,097,152. Applicatin space: 1.97MB max.
56  *
57  * Address
58  * ----------
59  * ---------------------- 005F FFFF (End of flash space)
60  * | File System Data |
61  * | 256KB |
62  * | 128K x 2 Blocks |
63  * |--------------------| 005C 0000 (Start of File System Data)
64  * | DESC BLOCK 0/1 |
65  * | 128K x 2 Blocks |
66  * |--------------------| 0058 0000 (Start of File System)
67  * | |
68  * | Application |
69  * | 1.375MB |
70  * | 128K x 11 Blocks |
71  * | |
72  * |--------------------| 0040 6004
73  * | 8K User Params |
74  * |--------------------| 0040 4000
75  * | 10K Configuration |
76  * |--------------------| 0040 1800
77  * | 6K Monitor |
78  * |--------------------| 0040 0000 (Start of Flash space)
79  *
80  *
81  * CHANGES TO COMPCODE FLAGS
82  * In NBEclipse, or your command line makefile, change the following line
83  * so the application will only occupy the specified application space.
84  * The first parameter is the start of application space, and the second
85  * is the address just below the file system space.
86  *
87  * COMPCODEFLAGS = 0x00406004 0x005A0000
88  *
89  * If using NBEclipse:
90  * - Right-click on the project and select "Properties"
91  * - Select "NetBurner" in the left side of the dialog box
92  * - Verify the Platform is set to Mod5234, then check the "Use Custom Platform Settings" checkbox
93  * - Modify the "Compcode Memory Range" to the above values
94  *
95  *
96  * If using NBEclipse, you will also need to tell the linker to include the
97  * /nburn/platform/<platform>/original/lib/libStdFFile.a library. To do this right-click on your
98  * project, select properties, GNU Linker, then add the library.
99  *
100  */
101 
102 
103 /* WARNING: These settings are for MX29GL256F bottom boot block flash
104  * components used on the Mod54415
105  */
106 #define BLOCKSIZE ( 16*512 ) // flash physical "sector" size
107 #define SECTORSIZE ( 512 ) // file system sectors per BLOCK
108 #define SECTORPERBLOCK (BLOCKSIZE/SECTORSIZE)
109 
110 /*
111  * Specify the total amount of flash memory in the system, and the amount
112  * allocated to be used by the file system (the rest is used by the
113  * application.
114  */
115 #define FLASH_SIZE ( 2*1024*1024 ) // size of total flash in the system, 32MB
116 #define FS_SIZE ( 256*512 ) // amount allocated to file system: 2 Desc. plus 1MB for data (8 x 128k)
117  // note that 1 block of file data will be reserved for the file system
118 #define FIRST_ADDR (FLASH_SIZE - FS_SIZE) // first file system address to use in the flash
119 #define BLOCKSTART 2 // first block where file system data starts
120  // (first 2 blocks are DESCRIPTORS)
121 
122 
123 /*
124  * Descriptor Blocks:
125  * These blocks contain critical information about the file system, block allocation,
126  * wear information and file/directory information. At least two descriptor blocks
127  * must be included in the system, which can be erased independently. An optional
128  * descriptor write cache may be configured which improves the performance of the
129  * file system. Please refer to the EFFS-STD implementation guide for additional
130  * information.
131  */
132 #define DESCSIZE ( 16*512 ) // size of one descriptor
133 #define DESCBLOCKSTART 0 // position of first descriptor
134 #define DESCBLOCKEND 1 // position of last descriptor
135 #define DESCCACHE 1024
136 
137 #endif /* _ONCHIPFLASH_H_ */
138 
139 
140 
Embedded Flash File System API - STD.
NetBurner Hardware Abstraction Layer (HAL)