-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from futurecore/zigzag
Adapteva zigzag tests now working
- Loading branch information
Showing
18 changed files
with
1,019 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
from revelation.storage import is_local_address | ||
|
||
from pydgin.elf import elf_reader | ||
from pydgin.utils import intmask | ||
|
||
|
||
def load_program(fp, mem, alignment=0, is_64bit=False, | ||
coreid=0x808, ext_base=0x8e000000, ext_size=32): | ||
"""Load an ELF file into an individual core. | ||
def load_program(elf, mem, coreids, alignment=0, ext_base=0x8e000000, | ||
ext_size=32): | ||
"""Copy the contents of an ELF file into individual cores. | ||
The 'elf' argument should be the result of a call to | ||
pydgin.elf.elf_reader(). | ||
""" | ||
elf = elf_reader(fp, is_64bit=is_64bit) | ||
sections = elf.get_sections() | ||
entrypoint = -1 | ||
coreid_mask = coreid << 20 | ||
for section in sections: | ||
if is_local_address(section.addr): | ||
start_addr = coreid_mask | section.addr | ||
else: | ||
start_addr = section.addr | ||
for index, data in enumerate(section.data): | ||
mem.write(start_addr + index, 1, ord(data), quiet=True) | ||
if section.name == '.text': | ||
entrypoint = intmask(section.addr) | ||
if section.name == '.data': | ||
mem.data_section = section.addr | ||
for coreid in coreids: | ||
coreid_mask = coreid << 20 | ||
for section in sections: | ||
if is_local_address(section.addr): | ||
start_addr = coreid_mask | section.addr | ||
else: | ||
start_addr = section.addr | ||
for index, data in enumerate(section.data): | ||
mem.write(start_addr + index, 1, ord(data), quiet=True) | ||
if section.name == '.text': | ||
entrypoint = intmask(section.addr) | ||
if section.name == '.data': | ||
mem.data_section = section.addr | ||
assert entrypoint >= 0 | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
LDF = ${EPIPHANY_HOME}/bsps/current/fast.ldf | ||
|
||
CC = e-gcc | ||
CFLAGS = -g -O0 -Wall -Wno-unused -Werror -ffast-math -falign-functions=8 | ||
EXTRA_CFLAGS = | ||
|
||
LDFLAGS = -T$(LDF) | ||
LDLIBS = -le-lib | ||
|
||
ELFS := zigzag2.elf zigzag4.elf zigzag16.elf zigzag64.elf zigzag120.elf zigzag768.elf zigzag4095.elf | ||
|
||
zigzag2.elf: EXTRA_CFLAGS := -DROWS=2 -DCOLS=1 -DFIRST_CORE=0x808 | ||
zigzag4.elf: EXTRA_CFLAGS := -DROWS=2 -DCOLS=2 -DFIRST_CORE=0x808 | ||
zigzag16.elf: EXTRA_CFLAGS := -DROWS=4 -DCOLS=4 -DFIRST_CORE=0x808 | ||
zigzag64.elf: EXTRA_CFLAGS := -DROWS=8 -DCOLS=8 -DFIRST_CORE=0x808 | ||
zigzag120.elf: EXTRA_CFLAGS := -DROWS=15 -DCOLS=8 -DFIRST_CORE=0x808 | ||
zigzag768.elf: EXTRA_CFLAGS := -DROWS=32 -DCOLS=24 -DFIRST_CORE=0x808 | ||
zigzag4095.elf: EXTRA_CFLAGS := -DROWS=64 -DCOLS=64 -DFIRST_CORE=0 | ||
zigzag4095.elf: LDFLAGS := -T./extraminternal.ldf | ||
|
||
all: ${ELFS} | ||
|
||
%.elf: zigzag.c | ||
${CC} -o $@ ${EXTRA_CFLAGS} ${CFLAGS} $< ${LDLIBS} -Wl,${LDFLAGS} | ||
|
||
clean: | ||
rm -f ${ELFS} |
Oops, something went wrong.