Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
7e51c5d6
Commit
7e51c5d6
authored
Jan 05, 2015
by
funshine
Browse files
replace SPIWrite with flash_write
parent
824655e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/gen_misc.bat
View file @
7e51c5d6
...
@@ -3,7 +3,7 @@ set BACKPATH=%PATH%
...
@@ -3,7 +3,7 @@ set BACKPATH=%PATH%
set
PATH
=
%BACKPATH%
;
%CD%
\..\tools
set
PATH
=
%BACKPATH%
;
%CD%
\..\tools
@echo
on
@echo
on
make
make
%
1
del
/F
..\bin\eagle.app.v6.flash.bin ..\bin\eagle.app.v6.irom0text.bin ..\bin\eagle.app.v6.dump ..\bin\eagle.app.v6.S
del
/F
..\bin\eagle.app.v6.flash.bin ..\bin\eagle.app.v6.irom0text.bin ..\bin\eagle.app.v6.dump ..\bin\eagle.app.v6.S
...
...
app/platform/flash_api.c
View file @
7e51c5d6
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "user_config.h"
#include "user_config.h"
#include "flash_api.h"
#include "flash_api.h"
#include "spi_flash.h"
#include "spi_flash.h"
#include "c_stdio.h"
static
volatile
const
uint8_t
flash_init_data
[
128
]
ICACHE_STORE_ATTR
ICACHE_RODATA_ATTR
=
static
volatile
const
uint8_t
flash_init_data
[
128
]
ICACHE_STORE_ATTR
ICACHE_RODATA_ATTR
=
{
{
...
@@ -74,7 +75,7 @@ bool flash_set_size(uint8_t size)
...
@@ -74,7 +75,7 @@ bool flash_set_size(uint8_t size)
SPIFlashInfo
*
p_spi_flash_info
=
(
SPIFlashInfo
*
)(
data
);
SPIFlashInfo
*
p_spi_flash_info
=
(
SPIFlashInfo
*
)(
data
);
p_spi_flash_info
->
size
=
size
;
p_spi_flash_info
->
size
=
size
;
SPIEraseSector
(
0
);
SPIEraseSector
(
0
);
SPIWrite
(
data
,
0
,
sizeof
(
data
));
spi_flash_write
(
0
,
(
uint32
*
)
data
,
sizeof
(
data
));
//p_spi_flash_info = flash_get_info();
//p_spi_flash_info = flash_get_info();
//p_spi_flash_info->size = size;
//p_spi_flash_info->size = size;
return
true
;
return
true
;
...
@@ -193,7 +194,7 @@ bool flash_init_data_default(void)
...
@@ -193,7 +194,7 @@ bool flash_init_data_default(void)
// It will init system data to default!
// It will init system data to default!
SPIEraseSector
((
flash_get_sec_num
()
-
4
));
SPIEraseSector
((
flash_get_sec_num
()
-
4
));
SPIW
rite
((
flash_get_sec_num
()
-
4
)
*
SPI_FLASH_SEC_SIZE
,
(
uint32
_t
*
)
flash_init_data
,
128
);
spi_flash_w
rite
((
flash_get_sec_num
()
-
4
)
*
SPI_FLASH_SEC_SIZE
,
(
uint32
*
)
flash_init_data
,
128
);
return
true
;
return
true
;
}
}
...
...
app/user/user_main.c
View file @
7e51c5d6
...
@@ -82,6 +82,12 @@ void user_init(void)
...
@@ -82,6 +82,12 @@ void user_init(void)
NODE_DBG
(
"Can not init platform for modules.
\n
"
);
NODE_DBG
(
"Can not init platform for modules.
\n
"
);
return
;
return
;
}
}
if
(
!
flash_init_data_written
()){
NODE_ERR
(
"Restore init data.
\n
"
);
flash_init_data_default
();
}
#if defined( BUILD_WOFS )
#if defined( BUILD_WOFS )
romfs_init
();
romfs_init
();
...
@@ -96,10 +102,6 @@ void user_init(void)
...
@@ -96,10 +102,6 @@ void user_init(void)
// test_romfs();
// test_romfs();
#elif defined ( BUILD_SPIFFS )
#elif defined ( BUILD_SPIFFS )
spiffs_mount
();
spiffs_mount
();
if
(
!
flash_init_data_written
()){
NODE_ERR
(
"Restore init data.
\n
"
);
flash_init_data_default
();
}
// test_spiffs();
// test_spiffs();
#endif
#endif
// endpoint_setup();
// endpoint_setup();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment