Skip to content

Commit 5d01386

Browse files
committed
STM32F4 - Enable storage driver
Enable storage driver for the following targets: - NUCLEO_F429ZI - DISCO_F429ZI - DISCO_F469NI
1 parent caf4fe6 commit 5d01386

File tree

7 files changed

+457
-3
lines changed

7 files changed

+457
-3
lines changed

hal/targets.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@
833833
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
834834
"progen": {"target": "nucleo-f429zi"},
835835
"macros": ["DEVICE_RTC_LSI=1", "TRANSACTION_QUEUE_SIZE_SPI=2"],
836-
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "RTC_LSI", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES", "TRNG"],
836+
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "RTC_LSI", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES", "STORAGE", "TRNG"],
837837
"detect_code": ["0796"],
838838
"features": ["IPV4"],
839839
"release_versions": ["2", "5"]
@@ -1075,7 +1075,7 @@
10751075
"macros": ["DEVICE_RTC_LSI=1","TRANSACTION_QUEUE_SIZE_SPI=2"],
10761076
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
10771077
"progen": {"target": "disco-f429zi"},
1078-
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES", "TRNG"],
1078+
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES", "STORAGE", "TRNG"],
10791079
"release_versions": ["2", "5"]
10801080
},
10811081
"DISCO_F469NI": {
@@ -1088,7 +1088,7 @@
10881088
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
10891089
"progen": {"target": "disco-f469ni"},
10901090
"detect_code": ["0788"],
1091-
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES", "TRNG"],
1091+
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES", "STORAGE", "TRNG"],
10921092
"release_versions": ["2", "5"]
10931093
},
10941094
"DISCO_L053C8": {
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2016, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
31+
#include "Driver_Storage.h"
32+
33+
ARM_STORAGE_BLOCK block_table[] = {
34+
{
35+
.addr = 0x08000000,
36+
.size = 0x00010000,
37+
.attributes = {
38+
.erasable = 1,
39+
.programmable = 1,
40+
.executable = 1,
41+
.protectable = 1,
42+
.erase_unit = 0x4000,
43+
.protection_unit = 0x4000,
44+
}
45+
},
46+
{
47+
.addr = 0x08010000,
48+
.size = 0x00010000,
49+
.attributes = {
50+
.erasable = 1,
51+
.programmable = 1,
52+
.executable = 1,
53+
.protectable = 1,
54+
.erase_unit = 0x10000,
55+
.protection_unit = 0x10000,
56+
}
57+
},
58+
{
59+
.addr = 0x08020000,
60+
.size = 0x000E0000,
61+
.attributes = {
62+
.erasable = 1,
63+
.programmable = 1,
64+
.executable = 1,
65+
.protectable = 1,
66+
.erase_unit = 0x20000,
67+
.protection_unit = 0x20000,
68+
}
69+
},
70+
{
71+
.addr = 0x08100000,
72+
.size = 0x00010000,
73+
.attributes = {
74+
.erasable = 1,
75+
.programmable = 1,
76+
.executable = 1,
77+
.protectable = 1,
78+
.erase_unit = 0x4000,
79+
.protection_unit = 0x4000,
80+
}
81+
},
82+
{
83+
.addr = 0x08110000,
84+
.size = 0x00010000,
85+
.attributes = {
86+
.erasable = 1,
87+
.programmable = 1,
88+
.executable = 1,
89+
.protectable = 1,
90+
.erase_unit = 0x10000,
91+
.protection_unit = 0x10000,
92+
}
93+
},
94+
{
95+
.addr = 0x08120000,
96+
.size = 0x000E0000,
97+
.attributes = {
98+
.erasable = 1,
99+
.programmable = 1,
100+
.executable = 1,
101+
.protectable = 1,
102+
.erase_unit = 0x20000,
103+
.protection_unit = 0x20000,
104+
}
105+
}
106+
};
107+
108+
size_t block_table_size = sizeof(block_table) / sizeof(ARM_STORAGE_BLOCK);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2016, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
#ifndef STORAGE_DRIVER_INFO_H
31+
#define STORAGE_DRIVER_INFO_H
32+
33+
/* Total size reserved for the storage */
34+
#define STORAGE_TOTAL_SIZE (0x00200000)
35+
36+
/*
37+
* Number of sector reserved for the firmware
38+
* This value must be block aligned.
39+
* The block repartition can be found in storage_driver_info.c
40+
*/
41+
#define STORAGE_START_SECTOR (12)
42+
43+
#endif /* STORAGE_DRIVER_INFO_H */
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2016, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
31+
#include "Driver_Storage.h"
32+
33+
ARM_STORAGE_BLOCK block_table[] = {
34+
{
35+
.addr = 0x08000000,
36+
.size = 0x00010000,
37+
.attributes = {
38+
.erasable = 1,
39+
.programmable = 1,
40+
.executable = 1,
41+
.protectable = 1,
42+
.erase_unit = 0x4000,
43+
.protection_unit = 0x4000,
44+
}
45+
},
46+
{
47+
.addr = 0x08010000,
48+
.size = 0x00010000,
49+
.attributes = {
50+
.erasable = 1,
51+
.programmable = 1,
52+
.executable = 1,
53+
.protectable = 1,
54+
.erase_unit = 0x10000,
55+
.protection_unit = 0x10000,
56+
}
57+
},
58+
{
59+
.addr = 0x08020000,
60+
.size = 0x000E0000,
61+
.attributes = {
62+
.erasable = 1,
63+
.programmable = 1,
64+
.executable = 1,
65+
.protectable = 1,
66+
.erase_unit = 0x20000,
67+
.protection_unit = 0x20000,
68+
}
69+
},
70+
{
71+
.addr = 0x08100000,
72+
.size = 0x00010000,
73+
.attributes = {
74+
.erasable = 1,
75+
.programmable = 1,
76+
.executable = 1,
77+
.protectable = 1,
78+
.erase_unit = 0x4000,
79+
.protection_unit = 0x4000,
80+
}
81+
},
82+
{
83+
.addr = 0x08110000,
84+
.size = 0x00010000,
85+
.attributes = {
86+
.erasable = 1,
87+
.programmable = 1,
88+
.executable = 1,
89+
.protectable = 1,
90+
.erase_unit = 0x10000,
91+
.protection_unit = 0x10000,
92+
}
93+
},
94+
{
95+
.addr = 0x08120000,
96+
.size = 0x000E0000,
97+
.attributes = {
98+
.erasable = 1,
99+
.programmable = 1,
100+
.executable = 1,
101+
.protectable = 1,
102+
.erase_unit = 0x20000,
103+
.protection_unit = 0x20000,
104+
}
105+
}
106+
};
107+
108+
size_t block_table_size = sizeof(block_table) / sizeof(ARM_STORAGE_BLOCK);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2016, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
#ifndef STORAGE_DRIVER_INFO_H
31+
#define STORAGE_DRIVER_INFO_H
32+
33+
/* Total size reserved for the storage */
34+
#define STORAGE_TOTAL_SIZE (0x00200000)
35+
36+
/*
37+
* Number of sector reserved for the firmware
38+
* This value must be block aligned.
39+
* The block repartition can be found in storage_driver_info.c
40+
*/
41+
#define STORAGE_START_SECTOR (12)
42+
43+
#endif /* STORAGE_DRIVER_INFO_H */

0 commit comments

Comments
 (0)