Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toerb
flow3r firmware
Commits
c4e9c913
Commit
c4e9c913
authored
1 year ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
revovery: POC writing an image
parent
2f97cdfd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
recovery/main/rec_main.c
+31
-1
31 additions, 1 deletion
recovery/main/rec_main.c
recovery/sdkconfig.defaults
+1
-0
1 addition, 0 deletions
recovery/sdkconfig.defaults
with
32 additions
and
1 deletion
recovery/main/rec_main.c
+
31
−
1
View file @
c4e9c913
...
...
@@ -17,6 +17,7 @@
#include
"esp_app_desc.h"
#include
"esp_app_format.h"
#include
"esp_partition.h"
#include
<dirent.h>
#include
<errno.h>
...
...
@@ -91,6 +92,35 @@ static void _list_select(void) {
// TODO: copy selected image over to app partition
_cur_menu
=
&
_main_menu
;
_cur_menu
->
selected
=
0
;
// app, app, ota_0, 0x90000, 0x300000,
const
esp_partition_t
*
p
=
esp_partition_find_first
(
ESP_PARTITION_TYPE_APP
,
ESP_PARTITION_SUBTYPE_APP_OTA_0
,
"app"
);
if
(
p
==
NULL
)
{
ESP_LOGE
(
TAG
,
"app partition not found"
);
return
;
}
printf
(
"erase size: %lu
\n
"
,
p
->
erase_size
);
uint8_t
buf
[
p
->
erase_size
];
size_t
n
;
size_t
offset
=
0
;
char
path
[
128
]
=
"/flash/hello.bin"
;
FILE
*
f
=
fopen
(
path
,
"rb"
);
do
{
n
=
fread
(
buf
,
1
,
sizeof
(
buf
),
f
);
if
(
n
>
0
)
{
esp_partition_erase_range
(
p
,
offset
,
sizeof
(
buf
));
esp_partition_write
(
p
,
offset
,
buf
,
n
);
offset
+=
n
;
printf
(
"wrote %u bytes
\n
"
,
offset
);
}
}
while
(
n
==
sizeof
(
buf
));
fclose
(
f
);
}
typedef
struct
{
...
...
@@ -162,7 +192,7 @@ static void _main_list(void) {
}
static
menu_entry_t
_main_menu_entries
[]
=
{
{
.
label
=
"
List
Image
s
"
,
.
enter
=
_main_list
},
{
.
label
=
"
Flash Firmware
Image"
,
.
enter
=
_main_list
},
{
.
label
=
"Reboot"
,
.
enter
=
_main_reboot
},
{
.
label
=
"Disk Mode (Flash)"
,
.
enter
=
_main_disk_mode_flash
},
{
.
label
=
"Disk Mode (SD)"
,
.
enter
=
_main_disk_mode_sd
},
...
...
This diff is collapsed.
Click to expand it.
recovery/sdkconfig.defaults
+
1
−
0
View file @
c4e9c913
...
...
@@ -12,6 +12,7 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP32S3_INSTRUCTION_CACHE_32KB=y
CONFIG_ESP32S3_DATA_CACHE_64KB=y
CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
CONFIG_FATFS_LFN_HEAP=y
CONFIG_FATFS_API_ENCODING_UTF_8=y
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment