Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
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
Container Registry
Model registry
Operate
Environments
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
Marek
firmware
Commits
e3ae63e8
Commit
e3ae63e8
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
fix(bootloader): Print current status on display
parent
87fba8d6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bootloader/main.c
+21
-11
21 additions, 11 deletions
bootloader/main.c
lib/card10/card10.c
+23
-23
23 additions, 23 deletions
lib/card10/card10.c
with
44 additions
and
34 deletions
bootloader/main.c
+
21
−
11
View file @
e3ae63e8
...
...
@@ -15,6 +15,9 @@
#include
"ff.h"
#include
"crc16-ccitt.h"
#include
"pb.h"
#include
"display.h"
#include
"GUI_Paint.h"
#include
"card10.h"
#include
"pmic.h"
...
...
@@ -194,19 +197,20 @@ static void pmic_button(bool falling)
/******************************************************************************/
int
main
(
void
)
{
/* Copied from card10_init() */
I2C_Shutdown
(
MXC_I2C0_BUS0
);
I2C_Init
(
MXC_I2C0_BUS0
,
I2C_FAST_MODE
,
NULL
);
I2C_Shutdown
(
MXC_I2C1_BUS0
);
I2C_Init
(
MXC_I2C1_BUS0
,
I2C_FAST_MODE
,
NULL
);
printf
(
"
\n\n
Bootloader
\n
"
);
card10_init
();
pmic_init
();
pmic_set_button_callback
(
pmic_button
);
printf
(
"
\n\n
Bootloader
\n
"
);
Paint_DrawString_EN
(
0
,
16
*
0
,
"Bootloader"
,
&
Font16
,
0x0000
,
0xffff
);
Paint_DrawString_EN
(
0
,
16
*
1
,
__DATE__
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
// If the button is pressed, we go into MSC mode.
if
(
PB_Get
(
0
)
||
PB_Get
(
1
))
{
Paint_DrawString_EN
(
0
,
16
*
2
,
"USB activated. Waiting."
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
run_usbmsc
();
// If we return, don't try to boot. Maybe rather trigger a software reset.
...
...
@@ -215,28 +219,34 @@ int main(void)
while
(
1
);
}
//MXC_FLC0->clkdiv = 96;
//MXC_FLC0->clkdiv = 96;
if
(
mount
())
{
if
(
check_integrity
())
{
printf
(
"Found valid application image
\n
"
);
if
(
is_update_needed
())
{
printf
(
"Trying to update application from external flash
\n
"
);
Paint_DrawString_EN
(
0
,
16
*
4
,
"Updating..."
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
erase_partition
();
flash_partition
();
}
else
{
printf
(
"No update needed
\n
"
);
}
}
else
{
Paint_DrawString_EN
(
0
,
16
*
2
,
"Integrity check failed"
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
printf
(
"Integrity check failed
\n
"
);
}
}
else
{
Paint_DrawString_EN
(
0
,
16
*
2
,
"Failed to mount file system"
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
printf
(
"Failed to mount the external flash
\n
"
);
}
printf
(
"Trying to boot
\n
"
);
Paint_DrawString_EN
(
0
,
16
*
4
,
"Trying to boot"
,
&
Font16
,
0x0000
,
0xffff
);
LCD_Update
();
//while(1);
// boot partition
boot
((
uintptr_t
*
)
PARTITION_START
);
...
...
This diff is collapsed.
Click to expand it.
lib/card10/card10.c
+
23
−
23
View file @
e3ae63e8
...
...
@@ -65,35 +65,12 @@ void card10_init(void)
while
(
1
);
}
display_init
();
leds_init
();
GPIO_Config
(
&
bhi_interrupt_pin
);
if
(
bhy_driver_init
(
bhy1_fw
))
{
printf
(
"Failed to init bhy
\n
"
);
}
else
{
/* wait for the bhy trigger the interrupt pin go down and up again */
while
(
GPIO_InGet
(
&
bhi_interrupt_pin
));
while
(
!
GPIO_InGet
(
&
bhi_interrupt_pin
));
/* the remapping matrix for BHI and Magmetometer should be configured here to make sure rotation vector is */
/* calculated in a correct coordinates system. */
int8_t
bhy_mapping_matrix_config
[
3
*
3
]
=
{
0
,
-
1
,
0
,
1
,
0
,
0
,
0
,
0
,
1
};
int8_t
mag_mapping_matrix_config
[
3
*
3
]
=
{
-
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
-
1
};
bhy_mapping_matrix_set
(
PHYSICAL_SENSOR_INDEX_ACC
,
bhy_mapping_matrix_config
);
bhy_mapping_matrix_set
(
PHYSICAL_SENSOR_INDEX_MAG
,
mag_mapping_matrix_config
);
bhy_mapping_matrix_set
(
PHYSICAL_SENSOR_INDEX_GYRO
,
bhy_mapping_matrix_config
);
/* the sic matrix should be calculated for customer platform by logging uncalibrated magnetometer data. */
/* the sic matrix here is only an example array (identity matrix). Customer should generate their own matrix. */
/* This affects magnetometer fusion performance. */
float
sic_array
[
9
]
=
{
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
};
bhy_set_sic_matrix
(
sic_array
);
}
portexpander_init
();
}
...
...
@@ -135,6 +112,29 @@ void card10_diag(void)
}
}
if
(
bhy_driver_init
(
bhy1_fw
))
{
printf
(
"Failed to init bhy
\n
"
);
}
else
{
/* wait for the bhy trigger the interrupt pin go down and up again */
while
(
GPIO_InGet
(
&
bhi_interrupt_pin
));
while
(
!
GPIO_InGet
(
&
bhi_interrupt_pin
));
/* the remapping matrix for BHI and Magmetometer should be configured here to make sure rotation vector is */
/* calculated in a correct coordinates system. */
int8_t
bhy_mapping_matrix_config
[
3
*
3
]
=
{
0
,
-
1
,
0
,
1
,
0
,
0
,
0
,
0
,
1
};
int8_t
mag_mapping_matrix_config
[
3
*
3
]
=
{
-
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
-
1
};
bhy_mapping_matrix_set
(
PHYSICAL_SENSOR_INDEX_ACC
,
bhy_mapping_matrix_config
);
bhy_mapping_matrix_set
(
PHYSICAL_SENSOR_INDEX_MAG
,
mag_mapping_matrix_config
);
bhy_mapping_matrix_set
(
PHYSICAL_SENSOR_INDEX_GYRO
,
bhy_mapping_matrix_config
);
/* the sic matrix should be calculated for customer platform by logging uncalibrated magnetometer data. */
/* the sic matrix here is only an example array (identity matrix). Customer should generate their own matrix. */
/* This affects magnetometer fusion performance. */
float
sic_array
[
9
]
=
{
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
};
bhy_set_sic_matrix
(
sic_array
);
}
struct
bme680_dev
gas_sensor
;
gas_sensor
.
dev_id
=
BME680_I2C_ADDR_PRIMARY
;
...
...
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