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
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
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
card10
firmware
Commits
2fa3090d
Commit
2fa3090d
authored
5 years ago
by
Serge Bazanski
Browse files
Options
Downloads
Patches
Plain Diff
appease annoyatron
parent
8ab8a96c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!45
l0dables: implement l0der
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
epicardium/l0der/l0der.c
+13
-10
13 additions, 10 deletions
epicardium/l0der/l0der.c
hw-tests/dual-core/main.c
+43
-36
43 additions, 36 deletions
hw-tests/dual-core/main.c
with
56 additions
and
46 deletions
epicardium/l0der/l0der.c
+
13
−
10
View file @
2fa3090d
...
...
@@ -59,9 +59,10 @@ static int _read_elf_header(int fd, Elf32_Ehdr *hdr)
{
int
res
;
epic_file_seek
(
fd
,
0
,
SEEK_SET
);
epic_file_seek
(
fd
,
0
,
SEEK_SET
);
if
((
res
=
epic_file_read
(
fd
,
hdr
,
sizeof
(
Elf32_Ehdr
)))
!=
sizeof
(
Elf32_Ehdr
))
{
if
((
res
=
epic_file_read
(
fd
,
hdr
,
sizeof
(
Elf32_Ehdr
)))
!=
sizeof
(
Elf32_Ehdr
))
{
LOG_ERR
(
"l0der"
,
"_read_elf_header: read failed: %d"
,
res
);
return
res
;
}
...
...
@@ -119,7 +120,7 @@ static int _seek_and_read(int fd, uint32_t address, void *data, size_t count)
}
if
((
res
=
epic_file_read
(
fd
,
data
,
count
))
!=
count
)
{
LOG_ERR
(
"l0der"
,
"_seek_and_read: could not read: %d"
,
res
);
LOG_ERR
(
"l0der"
,
"_seek_and_read: could not read: %d"
,
res
);
return
res
;
}
...
...
@@ -327,9 +328,9 @@ static int _load_segment(int fd, struct _pie_load_info *li, Elf32_Phdr *phdr)
/*
* Parse dynamic symbol sections.
*/
static
int
_parse_dynamic_symbols
(
int
fd
,
int
size
,
struct
_pie_load_info
*
li
,
Elf32_Ehdr
*
hdr
)
{
static
int
_parse_dynamic_symbols
(
int
fd
,
int
size
,
struct
_pie_load_info
*
li
,
Elf32_Ehdr
*
hdr
)
{
int
res
;
Elf32_Shdr
shdr
;
Elf32_Sym
sym
;
...
...
@@ -368,7 +369,7 @@ _parse_dynamic_symbols(int fd, int size, struct _pie_load_info *li, Elf32_Ehdr *
for
(
int
j
=
0
;
j
<
sym_count
;
j
++
)
{
if
((
res
=
epic_file_read
(
fd
,
&
sym
,
sizeof
(
Elf32_Sym
)))
!=
sizeof
(
Elf32_Sym
))
{
sizeof
(
Elf32_Sym
))
{
LOG_ERR
(
"l0der"
,
"__parse_dynamic_symbols: symbol read failed: %d"
,
res
);
...
...
@@ -401,7 +402,8 @@ _parse_dynamic_symbols(int fd, int size, struct _pie_load_info *li, Elf32_Ehdr *
* the only one used when making 'standard' PIE binaries on RAM. However, other
* kinds might have to be implemented in the future.
*/
static
int
_run_relocations
(
int
fd
,
int
size
,
struct
_pie_load_info
*
li
,
Elf32_Ehdr
*
hdr
)
static
int
_run_relocations
(
int
fd
,
int
size
,
struct
_pie_load_info
*
li
,
Elf32_Ehdr
*
hdr
)
{
int
res
;
Elf32_Shdr
shdr
;
...
...
@@ -448,7 +450,7 @@ static int _run_relocations(int fd, int size, struct _pie_load_info *li, Elf32_E
for
(
int
j
=
0
;
j
<
reloc_count
;
j
++
)
{
if
((
res
=
epic_file_read
(
fd
,
&
rel
,
sizeof
(
Elf32_Rel
)))
!=
sizeof
(
Elf32_Rel
))
{
sizeof
(
Elf32_Rel
))
{
LOG_ERR
(
"l0der"
,
"_run_relocations: relocation read failed: %d"
,
res
);
...
...
@@ -510,7 +512,8 @@ static int _run_relocations(int fd, int size, struct _pie_load_info *li, Elf32_E
/*
* Load a l0dable PIE binary.
*/
static
int
_load_pie
(
int
fd
,
int
size
,
Elf32_Ehdr
*
hdr
,
struct
l0dable_info
*
info
)
static
int
_load_pie
(
int
fd
,
int
size
,
Elf32_Ehdr
*
hdr
,
struct
l0dable_info
*
info
)
{
int
res
;
struct
_pie_load_info
li
=
{
0
};
...
...
This diff is collapsed.
Click to expand it.
hw-tests/dual-core/main.c
+
43
−
36
View file @
2fa3090d
...
...
@@ -18,40 +18,47 @@
int
main
(
void
)
{
card10_init
();
card10_diag
();
Paint_DrawImage
(
Heart
,
0
,
0
,
160
,
80
);
LCD_Update
();
for
(
int
i
=
0
;
i
<
11
;
i
++
)
{
leds_set_dim
(
i
,
1
);
}
int
h
=
0
;
// Release core1
core1_start
((
void
*
)
0x10080000
);
while
(
1
)
{
#define NUM 15
for
(
int
i
=
0
;
i
<
NUM
;
i
++
)
{
if
(
i
<
12
)
{
leds_set_hsv
(
i
,
(
h
+
360
/
NUM
*
i
)
%
360
,
1
.,
1
.
/
8
);
}
else
{
leds_set_hsv
(
i
,
(
h
+
360
/
NUM
*
i
)
%
360
,
1
.,
1
.);
}
}
leds_update
();
TMR_Delay
(
MXC_TMR0
,
MSEC
(
10
),
0
);
h
++
;
// Send a txev using `sev` every once in a while to wake up core1
// and let it do something
if
(
h
%
100
==
0
)
{
printf
(
"core0: Triggering core1 using SEV ...
\n
"
);
__asm
volatile
(
"sev"
);
}
}
card10_init
();
card10_diag
();
Paint_DrawImage
(
Heart
,
0
,
0
,
160
,
80
);
LCD_Update
();
for
(
int
i
=
0
;
i
<
11
;
i
++
)
{
leds_set_dim
(
i
,
1
);
}
int
h
=
0
;
// Release core1
core1_start
((
void
*
)
0x10080000
);
while
(
1
)
{
#define NUM 15
for
(
int
i
=
0
;
i
<
NUM
;
i
++
)
{
if
(
i
<
12
)
{
leds_set_hsv
(
i
,
(
h
+
360
/
NUM
*
i
)
%
360
,
1
.,
1
.
/
8
);
}
else
{
leds_set_hsv
(
i
,
(
h
+
360
/
NUM
*
i
)
%
360
,
1
.,
1
.
);
}
}
leds_update
();
TMR_Delay
(
MXC_TMR0
,
MSEC
(
10
),
0
);
h
++
;
// Send a txev using `sev` every once in a while to wake up core1
// and let it do something
if
(
h
%
100
==
0
)
{
printf
(
"core0: Triggering core1 using SEV ...
\n
"
);
__asm
volatile
(
"sev"
);
}
}
}
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