Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
François Revol
firmware
Commits
8a1b5c7f
Commit
8a1b5c7f
authored
Jul 05, 2019
by
schneider
Browse files
feat(bootloader): Application to update the bootloader
parent
e3ae63e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
hw-tests/bootloader-update/bootloader-e3ae63e.h
0 → 100644
View file @
8a1b5c7f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
hw-tests/bootloader-update/main.c
0 → 100644
View file @
8a1b5c7f
/*******************************************************************************
* License: TBD
******************************************************************************/
/***** Includes *****/
#include
"card10.h"
#include
"bootloader-e3ae63e.h"
#include
"display.h"
#include
"GUI_Paint.h"
#include
"pmic.h"
#include
"flc.h"
#include
"icc.h"
#include
"tmr_utils.h"
#include
<stdio.h>
#include
<stdint.h>
#include
<string.h>
#include
<stdbool.h>
/***** Definitions *****/
/***** Globals *****/
static
void
pmic_button
(
bool
falling
)
{
if
(
falling
)
{
printf
(
"Resetting ...
\n
"
);
/*
* Give the UART fifo time to clear.
* TODO: Do this properly
*/
for
(
int
i
=
0
;
i
<
0x1000000
;
i
++
)
{
__asm
volatile
(
"nop"
);
}
MXC_GCR
->
rstr0
=
MXC_F_GCR_RSTR0_SYSTEM
;
}
}
int
main
(
void
)
{
card10_init
();
pmic_set_button_callback
(
pmic_button
);
printf
(
"Erasing bootloader.
\n
"
);
Paint_DrawString_EN
(
0
,
16
*
0
,
"Erasing bootloader"
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
ICC_Disable
();
int
ret
=
FLC_MultiPageErase
(
0x10000000
,
0x10000000
+
1024
*
64
-
1
);
if
(
ret
!=
E_NO_ERROR
)
{
printf
(
"FLC_MultiPageErase failed with %d
\n
"
,
ret
);
Paint_DrawString_EN
(
0
,
16
*
1
,
"Fail."
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
while
(
1
);
}
printf
(
"Writing bootloader.
\n
"
);
Paint_DrawString_EN
(
0
,
16
*
0
,
"Writing bootloader "
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
ret
=
FLC_Write
(
0x10000000
,
sizeof
(
bootloader_data
),
(
uint32_t
*
)
bootloader_data
);
if
(
ret
!=
E_NO_ERROR
)
{
printf
(
"FLC_Write failed with %d
\n
"
,
ret
);
Paint_DrawString_EN
(
0
,
16
*
1
,
"Fail."
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
while
(
1
);
}
ICC_Enable
();
printf
(
"Done.
\n
"
);
Paint_DrawString_EN
(
0
,
16
*
1
,
"Done."
,
&
Font16
,
0x0000
,
0xffff
);
Paint_DrawString_EN
(
0
,
16
*
2
,
"Please restart"
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
while
(
1
)
{
card10_poll
();
}
}
hw-tests/bootloader-update/meson.build
0 → 100644
View file @
8a1b5c7f
name = 'bootloader-update'
elf = executable(
name + '.elf',
'main.c',
dependencies: [libcard10, max32665_startup],
link_whole: [max32665_startup_lib, board_card10_lib],
link_args: [
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
)
custom_target(
name + '.bin',
build_by_default: true,
output: name + '.bin',
input: elf,
command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
hw-tests/meson.build
View file @
8a1b5c7f
...
...
@@ -9,5 +9,6 @@ subdir('ecgtest/')
subdir('hello-world/')
subdir('imutest/')
subdir('ips/')
subdir('bootloader-update/')
# Disabled due to meson bug in older version
# subdir('upy-minimal/')
Write
Preview
Supports
Markdown
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