Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
260 commits
Select commit Hold shift + click to select a range
28bf61a
Create screeninit.h
OperationNT414C May 8, 2016
5fcf809
Create screeninit.c
OperationNT414C May 8, 2016
70bc364
Update main.c
OperationNT414C May 8, 2016
10cbbf5
Merge pull request #2 from OperationNT414C/OperationNT414C-patch-1
OperationNT414C May 8, 2016
319d290
Update config.h
OperationNT414C May 21, 2016
25cc254
Update config.c
OperationNT414C May 21, 2016
07e22e6
Update loader.h
OperationNT414C May 21, 2016
b6cbfd2
Update loader.c
OperationNT414C May 21, 2016
93c5e47
Update menu_boot.c
OperationNT414C May 21, 2016
66acb5e
Update menu_more.c
OperationNT414C May 21, 2016
d418394
Update config.c
OperationNT414C May 21, 2016
03ff3f7
Update config.h
OperationNT414C May 21, 2016
2daee4e
Update font.c
OperationNT414C May 21, 2016
6e0914d
Update font.h
OperationNT414C May 21, 2016
e99d5de
Update gfx.c
OperationNT414C May 21, 2016
227ce47
Update gfx.h
OperationNT414C May 21, 2016
cbafa29
Update menu.c
OperationNT414C May 21, 2016
3b2fffb
Update menu_boot.c
OperationNT414C May 21, 2016
e6bc4bc
Update text.c
OperationNT414C May 21, 2016
02da0af
Update config.c
OperationNT414C May 21, 2016
cf47e1c
Update config.c
OperationNT414C May 22, 2016
ce63241
Update memory.h
OperationNT414C May 22, 2016
79656a1
Update menu_more.c
OperationNT414C May 22, 2016
e848766
Update menu_picker.c
OperationNT414C May 22, 2016
18f9a1b
Update text.c
OperationNT414C May 22, 2016
289718a
Update utility.c
OperationNT414C May 22, 2016
130d00b
Update integer.h
OperationNT414C May 22, 2016
ebd2ff6
Update ffconf.h
OperationNT414C May 22, 2016
9d0290d
Update ff.h
OperationNT414C May 22, 2016
42c03c8
Update ff.c
OperationNT414C May 22, 2016
86cede4
Update diskio.c
OperationNT414C May 22, 2016
ca08e4c
Update 00readme.txt
OperationNT414C May 22, 2016
7d93203
Update and rename history.txt to 00history.txt
OperationNT414C May 22, 2016
71f1681
Update delay.h
OperationNT414C May 22, 2016
8aa1dde
Update delay.s
OperationNT414C May 22, 2016
c607722
Update sdmmc.c
OperationNT414C May 22, 2016
2a5b59b
Update sdmmc.h
OperationNT414C May 22, 2016
91b8ba0
Create ccsbcs.c
OperationNT414C May 22, 2016
9860b23
Create anim.h
OperationNT414C May 24, 2016
3daabc7
Create anim.c
OperationNT414C May 24, 2016
25dc26b
Update config.c
OperationNT414C May 24, 2016
f4937a8
Update config.h
OperationNT414C May 24, 2016
0e660e5
Update gfx.c
OperationNT414C May 24, 2016
669cc6d
Update main.c
OperationNT414C May 24, 2016
7b83f41
Update memory.h
OperationNT414C May 24, 2016
c4eeed5
Update menu.c
OperationNT414C May 24, 2016
5f0af1a
Update anim.c
OperationNT414C Jun 1, 2016
163f99b
Update config.c
OperationNT414C Jun 1, 2016
de04edb
Update config.h
OperationNT414C Jun 1, 2016
6ed6141
Update menu_boot.c
OperationNT414C Jun 1, 2016
208227e
Update menu_more.c
OperationNT414C Jun 1, 2016
23b901d
Update menu_picker.c
OperationNT414C Jun 1, 2016
fd1e286
Update README.md
OperationNT414C Jun 12, 2016
d3d3758
Update README.md
OperationNT414C Jun 12, 2016
5962434
Create movie.c
OperationNT414C Jun 12, 2016
d8a1c18
Create movie.h
OperationNT414C Jun 12, 2016
140c763
Create quicklz.c
OperationNT414C Jun 12, 2016
71da5ac
Create quicklz.h
OperationNT414C Jun 12, 2016
322e91a
Update anim.c
OperationNT414C Jun 12, 2016
494446d
Update anim.h
OperationNT414C Jun 12, 2016
fe1d5ff
Update config.c
OperationNT414C Jun 12, 2016
848ac19
Update config.h
OperationNT414C Jun 12, 2016
52956bf
Update main.c
OperationNT414C Jun 12, 2016
b5dc180
Update memory.h
OperationNT414C Jun 12, 2016
5cff3c9
Update menu.c
OperationNT414C Jun 12, 2016
ab9b69e
Update utility.c
OperationNT414C Jun 12, 2016
353e9c2
Update utility.h
OperationNT414C Jun 12, 2016
1bf9198
Update README.md
OperationNT414C Jun 12, 2016
cab3854
Update anim.c
OperationNT414C Jun 17, 2016
30efc3b
Update anim.h
OperationNT414C Jun 17, 2016
47a6a19
Update config.c
OperationNT414C Jun 17, 2016
b0f60ff
Update config.h
OperationNT414C Jun 17, 2016
50a061a
Update memory.h
OperationNT414C Jun 17, 2016
3108b11
Update menu_config.c
OperationNT414C Jun 17, 2016
2eeb3b5
Update movie.c
OperationNT414C Jun 17, 2016
69274db
Update movie.h
OperationNT414C Jun 17, 2016
664a010
Update anim.c
OperationNT414C Jun 17, 2016
f899db9
Update loader.h
OperationNT414C Jun 17, 2016
bae8b6a
Update screeninit.c
OperationNT414C Jun 17, 2016
d80bfa2
Update screeninit.h
OperationNT414C Jun 17, 2016
598e47d
Update utility.c
OperationNT414C Jun 17, 2016
bd4fd97
Update anim.c
OperationNT414C Jun 18, 2016
cc2a607
Update movie.c
OperationNT414C Jun 18, 2016
7ad2b08
Update menu_config.c
OperationNT414C Jun 18, 2016
dad0601
Update anim.c
OperationNT414C Jun 26, 2016
5fb042a
Update anim.h
OperationNT414C Jun 26, 2016
28a9c8d
Update config.c
OperationNT414C Jun 26, 2016
b39a29e
Update config.h
OperationNT414C Jun 26, 2016
fc7f0f4
Update gfx.c
OperationNT414C Jun 26, 2016
3e15ce5
Update gfx.h
OperationNT414C Jun 26, 2016
6608f73
Update menu.c
OperationNT414C Jun 26, 2016
9c724e8
Update menu_config.c
OperationNT414C Jun 26, 2016
64e7c54
Update utility.c
OperationNT414C Jun 26, 2016
99d20ab
Update config.h
OperationNT414C Jun 29, 2016
61cdcaa
Update loader.c
OperationNT414C Jun 29, 2016
1eb22e9
Update menu.c
OperationNT414C Jun 29, 2016
3c6675a
Update and rename gfx.h to draw.h
OperationNT414C Jun 29, 2016
1c1c56b
Update and rename gfx.c to draw.c
OperationNT414C Jun 29, 2016
3d6d72f
Update menu_boot.c
OperationNT414C Jun 29, 2016
161e099
Update menu_config.c
OperationNT414C Jun 29, 2016
104a5d4
Update menu_more.c
OperationNT414C Jun 29, 2016
974f144
Update menu_netloader.c
OperationNT414C Jun 29, 2016
fa5b903
Update menu_netloaderarm9.c
OperationNT414C Jun 29, 2016
a67ffc5
Update menu_picker.c
OperationNT414C Jun 29, 2016
d52641b
Update utility.c
OperationNT414C Jun 29, 2016
6b1b1a0
Update common.h
OperationNT414C Jun 29, 2016
979cb92
Update netloader.c
OperationNT414C Jun 29, 2016
fe3b33b
Update anim.c
OperationNT414C Aug 18, 2016
933d8b9
Update anim.h
OperationNT414C Aug 18, 2016
6dc9fa5
Update config.c
OperationNT414C Aug 18, 2016
d61d7e0
Update config.h
OperationNT414C Aug 18, 2016
ee3ebe7
Update draw.c
OperationNT414C Aug 18, 2016
e73d596
Update draw.h
OperationNT414C Aug 18, 2016
7f807bc
Update main.c
OperationNT414C Aug 18, 2016
c31fc06
Update memory.h
OperationNT414C Aug 18, 2016
adeb5a4
Update menu.c
OperationNT414C Aug 18, 2016
7954b31
Update menu_boot.c
OperationNT414C Aug 18, 2016
d13149c
Update menu_config.c
OperationNT414C Aug 18, 2016
294f3dc
Update menu_picker.c
OperationNT414C Aug 18, 2016
a4ea565
Update screeninit.c
OperationNT414C Aug 18, 2016
01ad83e
Update screeninit.h
OperationNT414C Aug 18, 2016
850ce8b
Update text.c
OperationNT414C Aug 18, 2016
5b292a9
Update utility.c
OperationNT414C Aug 18, 2016
e5d7811
Update utility.h
OperationNT414C Aug 18, 2016
fd0bc28
Update changelog.txt
OperationNT414C Aug 18, 2016
f184426
Update changelog.txt
OperationNT414C Aug 18, 2016
9562014
Create menu_password.c
OperationNT414C Sep 4, 2016
42862ef
Update config.c
OperationNT414C Sep 4, 2016
896d0cd
Update config.h
OperationNT414C Sep 4, 2016
5fe4adf
Update draw.c
OperationNT414C Sep 4, 2016
16f670a
Update draw.h
OperationNT414C Sep 4, 2016
d2d16a7
Update loader.c
OperationNT414C Sep 4, 2016
576ffa5
Update loader.h
OperationNT414C Sep 4, 2016
0ef1c66
Update menu.c
OperationNT414C Sep 4, 2016
a1928a7
Update menu.h
OperationNT414C Sep 4, 2016
a7f047c
Update menu_boot.c
OperationNT414C Sep 4, 2016
cb06519
Update menu_config.c
OperationNT414C Sep 4, 2016
c5928b2
Update menu_more.c
OperationNT414C Sep 4, 2016
3fa5ccf
Update menu_netloader.c
OperationNT414C Sep 4, 2016
7e048da
Update menu_netloaderarm9.c
OperationNT414C Sep 4, 2016
9448b2f
Update changelog.txt
OperationNT414C Sep 4, 2016
04c13d8
Update config.c
OperationNT414C Oct 7, 2016
4fc4fce
Update config.h
OperationNT414C Oct 7, 2016
2475d0f
Update main.c
OperationNT414C Oct 7, 2016
97ebc80
Update menu_boot.c
OperationNT414C Oct 7, 2016
c2d1cbe
Update menu_config.c
OperationNT414C Oct 7, 2016
9fb626e
Update changelog.txt
OperationNT414C Oct 7, 2016
b288e0e
Update loader.c
OperationNT414C Oct 9, 2016
5da4559
Update menu_config.c
OperationNT414C Oct 9, 2016
65b8255
Update changelog.txt
OperationNT414C Oct 9, 2016
e73f3c7
Update changelog.txt
OperationNT414C Oct 9, 2016
7763fa1
Update changelog.txt
OperationNT414C May 20, 2017
b8b7446
Update README.md
OperationNT414C May 20, 2017
68594d1
Update CMakeLists.txt
OperationNT414C May 20, 2017
aa35d2c
Create loader.h
OperationNT414C May 20, 2017
3873016
Create linker.ld
OperationNT414C May 20, 2017
e5ee3a7
Create Makefile
OperationNT414C May 20, 2017
1dce43a
Create cache.h
OperationNT414C May 20, 2017
5ddb2cc
Create cache.s
OperationNT414C May 20, 2017
6000e76
Create firm.c
OperationNT414C May 20, 2017
d1b4c22
Create firm.h
OperationNT414C May 20, 2017
f1fc5a5
Create main.c
OperationNT414C May 20, 2017
3226509
Create memory.c
OperationNT414C May 20, 2017
acb3b65
Create memory.h
OperationNT414C May 20, 2017
86659a8
Create start.s
OperationNT414C May 20, 2017
9d7f6d6
Create types.h
OperationNT414C May 20, 2017
61f1a32
Update loader.c
OperationNT414C May 20, 2017
6620876
Update loader.h
OperationNT414C May 20, 2017
7314daa
Update memory.h
OperationNT414C May 20, 2017
cce7c24
Update menu_config.c
OperationNT414C May 20, 2017
10d7bce
Update menu_picker.c
OperationNT414C May 20, 2017
69b8d73
Create firm.c
OperationNT414C May 20, 2017
5a5e05c
Create firm.h
OperationNT414C May 20, 2017
13f57b0
Create sha.c
OperationNT414C May 20, 2017
568a79d
Create sha.h
OperationNT414C May 20, 2017
e6b9944
Update README.md
OperationNT414C May 20, 2017
5955df8
Update changelog.txt
OperationNT414C May 25, 2017
f9719d2
Update README.md
OperationNT414C May 25, 2017
9a323ed
Update config.c
OperationNT414C May 25, 2017
53c49d5
Update config.h
OperationNT414C May 25, 2017
bd502fb
Update loader.c
OperationNT414C May 25, 2017
d3174f2
Update main.c
OperationNT414C May 25, 2017
b31b15c
Update memory.h
OperationNT414C May 25, 2017
3abbb84
Update menu_config.c
OperationNT414C May 25, 2017
17b87f0
Update menu_more.c
OperationNT414C May 25, 2017
c16bba6
Update menu_picker.c
OperationNT414C May 25, 2017
369dd7e
Update utility.c
OperationNT414C May 25, 2017
a15e4e9
Update utility.h
OperationNT414C May 25, 2017
eb1d5e5
Update bs-start.s
OperationNT414C May 25, 2017
f03af28
Create 3dsheaders.h
OperationNT414C May 25, 2017
62ed427
Create common.c
OperationNT414C May 25, 2017
2479764
Update common.h
OperationNT414C May 25, 2017
ede9076
Update and rename sha.c to crypto.c
OperationNT414C May 25, 2017
09c2d08
Update and rename sha.h to crypto.h
OperationNT414C May 25, 2017
133c248
Update firm.c
OperationNT414C May 25, 2017
c09b109
Update 00history.txt
OperationNT414C May 25, 2017
872fb91
Update 00readme.txt
OperationNT414C May 25, 2017
479f853
Update diskio.c
OperationNT414C May 25, 2017
46c493b
Update ff.c
OperationNT414C May 25, 2017
cb288ba
Update ff.h
OperationNT414C May 25, 2017
71896ec
Update ffconf.h
OperationNT414C May 25, 2017
d4df38c
Update integer.h
OperationNT414C May 25, 2017
3063dbb
Delete syscall.c
OperationNT414C May 25, 2017
997d60d
Delete common.h
OperationNT414C May 25, 2017
3f801f5
Update delay.h
OperationNT414C May 25, 2017
1666a2c
Update delay.s
OperationNT414C May 25, 2017
a6c4aa7
Update sdmmc.c
OperationNT414C May 25, 2017
569b2d9
Update sdmmc.h
OperationNT414C May 25, 2017
bb9817a
Update README.md
OperationNT414C May 29, 2017
3a139f1
Update README.md
OperationNT414C Jun 7, 2017
339ca72
Update changelog.txt
OperationNT414C Jun 7, 2017
93bed32
Update and rename loader.h to chainloader.h
OperationNT414C Jun 7, 2017
29e1c4f
Update screeninit.h
OperationNT414C Jun 7, 2017
dc1b0d3
Update and rename loader/linker.ld to chainloader/linker.ld
OperationNT414C Jun 7, 2017
1367f5c
Update and rename loader/Makefile to chainloader/Makefile
OperationNT414C Jun 7, 2017
38d1115
Update and rename loader/source/cache.h to chainloader/source/cache.h
OperationNT414C Jun 7, 2017
499bc90
Update and rename loader/source/cache.s to chainloader/source/cache.s
OperationNT414C Jun 7, 2017
c5b6588
Update and rename loader/source/firm.c to chainloader/source/firm.c
OperationNT414C Jun 7, 2017
830fc0f
Update and rename loader/source/firm.h to chainloader/source/firm.h
OperationNT414C Jun 7, 2017
fd7dd37
Update and rename loader/source/main.c to chainloader/source/main.c
OperationNT414C Jun 7, 2017
1900e55
Update and rename loader/source/memory.c to chainloader/source/memory.c
OperationNT414C Jun 7, 2017
93d01bc
Update and rename loader/source/memory.h to chainloader/source/memory.h
OperationNT414C Jun 7, 2017
fb0bb6b
Update and rename loader/source/start.s to chainloader/source/start.s
OperationNT414C Jun 7, 2017
59cb642
Update and rename loader/source/types.h to chainloader/source/types.h
OperationNT414C Jun 7, 2017
4517e85
Update and rename source/screeninit.h to source/arm9/source/screen.h
OperationNT414C Jun 7, 2017
e5da0b7
Update and rename source/screeninit.c to source/arm9/source/screen.c
OperationNT414C Jun 7, 2017
19b4b83
Update brahma.c
OperationNT414C Jun 7, 2017
8ea25b3
Update boot.c
OperationNT414C Jun 7, 2017
ac9157c
Update draw.c
OperationNT414C Jun 7, 2017
f83be1a
Update loader.c
OperationNT414C Jun 7, 2017
1bf9d56
Update main.c
OperationNT414C Jun 7, 2017
3d45a15
Update memory.h
OperationNT414C Jun 7, 2017
b038639
Update menu_boot.c
OperationNT414C Jun 7, 2017
648ab75
Update menu_config.c
OperationNT414C Jun 7, 2017
9e5605f
Update menu_more.c
OperationNT414C Jun 7, 2017
fe9e476
Update menu_picker.c
OperationNT414C Jun 7, 2017
9e9b313
Update utility.c
OperationNT414C Jun 7, 2017
830a356
Update bs-start.s
OperationNT414C Jun 7, 2017
683a4d2
Update firm.c
OperationNT414C Jun 7, 2017
dcb9693
Update firm.h
OperationNT414C Jun 7, 2017
268bd85
Update README.md
OperationNT414C Jun 7, 2017
f94b644
Update screeninit.h
OperationNT414C Jun 9, 2017
1a2ac48
Update main.c
OperationNT414C Jun 9, 2017
8d0799b
Update draw.c
OperationNT414C Jun 9, 2017
fd641ee
Update main.c
OperationNT414C Jun 9, 2017
363ba13
Update memory.h
OperationNT414C Jun 9, 2017
3395b4b
Update menu_config.c
OperationNT414C Jun 9, 2017
ed28cb0
Update screen.c
OperationNT414C Jun 9, 2017
e7d3866
Create changelog.txt
OperationNT414C Jun 9, 2017
419f925
Update changelog.txt
OperationNT414C Jun 9, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ file(GLOB_RECURSE SOURCE_FILES
file(GLOB_RECURSE SOURCE_FILES_ARM9
source/arm9/source/*
)
file(GLOB_RECURSE SOURCE_FILES_SCREENINIT
screeninit/source/*
)
file(GLOB_RECURSE SOURCE_FILES_LOADER
loader/source/*
)

# Filter
file(GLOB FILTER_FILES
Expand Down Expand Up @@ -59,6 +65,30 @@ add_netload_target(CtrBootManager_3dslink CtrBootManager)
add_citra_target(CtrBootManager_Citra CtrBootManager)
#set_target_properties(CtrBootManager PROPERTIES COMPILE_FLAGS "-DCITRA")

###################
# Screen init
###################
add_executable(screeninit ${SOURCE_FILES_SCREENINIT})
set(ASFLAGS "-mcpu=mpcore -mfloat-abi=hard")
set(CFLAGS "-Wall -Wextra -MMD -MP -mthumb -mthumb-interwork $(ASFLAGS) -fno-builtin -std=c11 -Wno-main -O2 -flto -ffast-math")
set_target_properties(screeninit PROPERTIES COMPILE_FLAGS ${CFLAGS})
set_source_files_properties(screeninit/source/start.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp ${CFLAGS}")
set_target_properties(screeninit PROPERTIES LINK_FLAGS
"-nostdlib -nostartfiles -g -mthumb -mthumb-interwork -Wl,-Map,screeninit.map -T ${CMAKE_SOURCE_DIR}/screeninit/linker.ld ")
add_a9lh_target(screeninit_a9lh screeninit)

###################
# FIRM loader
###################
add_executable(loader ${SOURCE_FILES_LOADER})
set(ASFLAGS "-mcpu=mpcore -mfloat-abi=hard")
set(CFLAGS "-Wall -Wextra -MMD -MP -mthumb -mthumb-interwork $(ASFLAGS) -fno-builtin -std=c11 -Wno-main -O2 -flto -ffast-math")
set_target_properties(loader PROPERTIES COMPILE_FLAGS ${CFLAGS})
set_source_files_properties(loader/source/start.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp ${CFLAGS}")
set_target_properties(loader PROPERTIES LINK_FLAGS
"-nostdlib -nostartfiles -g -mthumb -mthumb-interwork -Wl,-Map,loader.map -T ${CMAKE_SOURCE_DIR}/loader/linker.ld ")
add_a9lh_target(loader_a9lh loader)

###################
# CtrBootManager9
###################
Expand Down
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@
CtrBootManager is a boot manager for some 3DS homebrew applications, like HBL and CFW.

##Dependencies
- devkitpro-4.5 at least (ctrulib-1.0 at least)
- devkitpro-4.5 at least (ctrulib-1.2.1 at least)
- libconfig in portlibs (tried with v1.5)

##Building

###The recommended way:
1. `mkdir build/`
2. `cd build/`
3. `cmake -DCMAKE_TOOLCHAIN_FILE=../DevkitArm3DS.cmake ../`
4. `cmake --build . --target CtrBootManager_a9lh`
4. `cmake --build . --target screeninit_a9lh`
5. `bin2h -c screeninit < screeninit.bin > screeninit.h`
6. `cmake --build . --target chainloader_a9lh`
7. `bin2h -c chainloader < chainloader.bin > chainloader.h`
8. `cmake --build . --target CtrBootManager_a9lh`

Binaries should now be in the `build` folder.

##Credits

###To original developer:
* Cpasjuste

###For contributions to hb_menu:
* smea : code
* GEMISIS : code
Expand All @@ -25,6 +34,23 @@ Binaries should now be in the `build` folder.
* Arkhandar : graphics
* dotjasp : graphics (regionfree icon)

###For screeninit code:
* Aurora Wright
* dark_samus
* bil1s
* Normmatt
* delebile
* tiniVi

###For FIRM loader and CtrNAND reading code:
* Aurora Wright
* TuxSH

###For movies support code example:
* Wolfvak
* d0k3 : compressed movies

###Other credits:

Readme by gemarcano
This project also uses [Brahma](https://github.com/patois/Brahma). See its repository for its credits.
This project also uses [Brahma](https://github.com/patois/Brahma). See its repository for its credits.
12 changes: 12 additions & 0 deletions build/chainloader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const char chainloader[]={
0x00,0xd0,0x1f,0xe5,0x45,0x00,0x00,0xea,0x00,0xb8,0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x10,0xa0,0xe3,0x00,0x00,0xa0,0xe3,0x00,0x20,0x81,0xe1,0x5e,0x2f,0x07,0xee,0x20
,0x00,0x80,0xe2,0x01,0x0b,0x50,0xe3,0xfa,0xff,0xff,0x1a,0x01,0x11,0x81,0xe2,0x00,0x00,0x51,0xe3,0xf6,0xff,0xff,0x1a,0x9a,0x1f,0x07,0xee,0x15,0x1f,0x07,0xee,0x1e
,0xff,0x2f,0xe1,0xf0,0xb5,0xcf,0xb0,0x0f,0x00,0x69,0x46,0x00,0x28,0x12,0xdd,0x8b,0x26,0x3d,0x68,0x00,0x23,0x08,0xac,0x76,0x00,0x03,0xe0,0xe2,0x54,0x01,0x33,0xb3
,0x42,0x02,0xd0,0xea,0x5c,0x00,0x2a,0xf8,0xd1,0x00,0x22,0x00,0x94,0xe2,0x54,0x69,0x46,0x02,0x28,0x18,0xd0,0x14,0x4e,0x14,0x4f,0xb5,0x68,0x73,0x68,0x32,0x68,0x00
,0x2d,0x09,0xd0,0x12,0x4c,0xa4,0x46,0x5d,0x19,0x62,0x44,0x14,0x78,0x1c,0x70,0x01,0x33,0x01,0x32,0xab,0x42,0xf9,0xd1,0x30,0x36,0xbe,0x42,0xed,0xd1,0x0c,0x4a,0x93
,0x68,0xd2,0x68,0x00,0xf0,0x38,0xf8,0x79,0x68,0x13,0x00,0x02,0xaa,0xcc,0x5c,0xd4,0x54,0x01,0x33,0x0c,0x2b,0xfa,0xd1,0xcc,0x5c,0xd4,0x54,0x01,0x33,0x18,0x2b,0xfa
,0xd1,0x69,0x46,0x01,0x92,0xd6,0xe7,0x40,0x10,0x00,0x20,0x00,0x11,0x00,0x20,0x00,0x10,0x00,0x20,0x00,0x40,0xa0,0xe1,0x01,0x50,0xa0,0xe1,0x02,0x60,0xa0,0xe1,0x03
,0x70,0xa0,0xe1,0xc9,0xff,0xff,0xeb,0x10,0x0f,0x11,0xee,0x01,0x0a,0xc0,0xe3,0x04,0x00,0xc0,0xe3,0x01,0x00,0xc0,0xe3,0x10,0x0f,0x01,0xee,0x02,0x02,0xa0,0xe3,0x04
,0x70,0x00,0xe5,0x04,0x00,0xa0,0xe1,0x05,0x10,0xa0,0xe1,0x00,0x20,0x1f,0xe5,0x16,0xff,0x2f,0xe1,0xef,0xbe,0x01,0x00,0x78,0x47,0xc0,0x46,0xec,0xff,0xff,0xea,0x00
,0xc0,0x9f,0xe5,0x1c,0xff,0x2f,0xe1,0x45,0x90,0xff,0x01,0x00,0x00,0x00,0x00};
const int chainloader_size=304;
32 changes: 32 additions & 0 deletions build/screeninit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const char screeninit[]={
0xc0,0x01,0x0c,0xf1,0x01,0x00,0x00,0xea,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x9f,0xe5,0x1c,0xff,0x2f,0xe1,0x21,0xfc,0xff,0x24,0x00,0x00,0x00,0x00,0x30
,0xb5,0x85,0xb0,0x69,0x46,0x81,0x4a,0x31,0xca,0x31,0xc1,0x12,0x68,0x80,0x48,0x0a,0x60,0x80,0x49,0x80,0x4a,0x12,0x68,0x08,0x60,0x01,0x20,0x6b,0x46,0x7f,0x49,0x7f
,0x4c,0x08,0x60,0x7f,0x4d,0x21,0x68,0x29,0x40,0x21,0x60,0x92,0x00,0xd4,0x58,0x7d,0x49,0x0c,0x60,0xd2,0x58,0x7d,0x4b,0x1a,0x60,0x7d,0x4b,0x7d,0x4a,0x13,0x60,0x7d
,0x4a,0x13,0x60,0xe1,0x22,0x7d,0x4b,0x52,0x00,0x1a,0x60,0x7c,0x4b,0xf1,0x3a,0x1a,0x60,0xc2,0x23,0x7b,0x49,0xff,0x33,0x0b,0x60,0x7b,0x49,0x0b,0x60,0x00,0x23,0xcf
,0x24,0x7a,0x49,0x0b,0x60,0x7a,0x49,0x0c,0x60,0x7a,0x49,0x0a,0x60,0x7a,0x49,0x7a,0x4a,0x11,0x60,0x80,0x21,0x7a,0x4a,0x49,0x02,0x11,0x60,0x9e,0x21,0x79,0x4a,0xff
,0x31,0x11,0x60,0x78,0x4a,0x9c,0x39,0xff,0x39,0x11,0x60,0xc9,0x22,0x77,0x4c,0x52,0x00,0x22,0x60,0x76,0x4c,0x22,0x60,0x76,0x4c,0x22,0x60,0x76,0x4a,0x10,0x60,0x76
,0x4a,0x11,0x60,0x76,0x49,0x77,0x4a,0x11,0x60,0x77,0x4a,0x13,0x60,0x77,0x4a,0x77,0x49,0x13,0x60,0x77,0x4a,0x11,0x60,0x77,0x49,0x78,0x4a,0x11,0x60,0x78,0x49,0x78
,0x4a,0x11,0x60,0x78,0x49,0x79,0x4a,0x11,0x60,0xc2,0x22,0x78,0x48,0x52,0x05,0x02,0x60,0x78,0x4c,0x78,0x48,0x04,0x60,0x78,0x4c,0x79,0x48,0x04,0x60,0xb4,0x24,0x78
,0x48,0x03,0x60,0x78,0x48,0xa4,0x00,0x04,0x60,0x78,0x48,0x01,0x60,0x78,0x49,0x0a,0x60,0x78,0x4a,0x78,0x49,0x13,0x60,0x78,0x4a,0x79,0x48,0x84,0x46,0x0b,0x60,0x63
,0x44,0x93,0x42,0xf9,0xd1,0xe1,0x22,0x76,0x4b,0x52,0x00,0x1a,0x60,0xd1,0x23,0x75,0x4a,0x13,0x60,0xc2,0x22,0x75,0x49,0xff,0x32,0x0a,0x60,0x74,0x49,0x0a,0x60,0xcd
,0x21,0x74,0x4a,0x11,0x60,0x74,0x4a,0x02,0x31,0x11,0x60,0x73,0x4a,0x13,0x60,0x49,0x4a,0x73,0x4b,0x1a,0x60,0x80,0x22,0x72,0x4b,0x52,0x02,0x1a,0x60,0x9e,0x22,0x71
,0x4b,0xff,0x32,0x1a,0x60,0x52,0x23,0x70,0x4a,0x13,0x60,0xc9,0x22,0x70,0x49,0x52,0x00,0x0a,0x60,0x6f,0x49,0x0a,0x60,0x4f,0x21,0x6f,0x4a,0x11,0x60,0x6f,0x4a,0x01
,0x31,0x11,0x60,0x6e,0x4a,0x13,0x60,0x6e,0x4a,0x6f,0x4b,0x1a,0x60,0x00,0x23,0x6e,0x4a,0x13,0x60,0x6e,0x4a,0x3f,0x39,0x11,0x60,0x6e,0x49,0x6e,0x4a,0x11,0x60,0x45
,0x49,0x6e,0x4a,0x11,0x60,0x6e,0x49,0x6e,0x4a,0x11,0x60,0x6e,0x49,0x6f,0x4a,0x11,0x60,0x6f,0x49,0x6f,0x4a,0x11,0x60,0x6f,0x49,0x70,0x4a,0x11,0x60,0x47,0x49,0x6f
,0x4a,0x11,0x60,0xb4,0x21,0x6f,0x4a,0x13,0x60,0x6f,0x4a,0x89,0x00,0x11,0x60,0x6e,0x4a,0x6f,0x49,0x13,0x60,0x49,0x4a,0x49,0x48,0x84,0x46,0x0b,0x60,0x63,0x44,0x93
,0x42,0xf9,0xd1,0x38,0x4b,0x39,0x4a,0x13,0x60,0xc2,0x22,0x38,0x49,0x52,0x05,0x0a,0x60,0x3e,0x49,0x0b,0x60,0x3e,0x49,0x0a,0x60,0x5b,0x4a,0x5b,0x49,0x5c,0x48,0x0a
,0x60,0x5c,0x49,0x08,0x60,0x63,0x49,0x0b,0x60,0x63,0x49,0x0b,0x60,0x63,0x4b,0x1a,0x60,0x00,0x23,0x62,0x4a,0x13,0x60,0x13,0x68,0x00,0x2b,0xfc,0xd0,0x13,0x68,0x00
,0xf0,0xc0,0xf8,0x05,0xb0,0x30,0xbc,0x01,0xbc,0x00,0x47,0xa8,0xff,0xff,0x24,0x7f,0x00,0x01,0x00,0x00,0x12,0x14,0x10,0x08,0xfc,0xff,0x24,0x14,0x20,0x20,0x10,0x0c
,0x20,0x20,0x10,0xfe,0xff,0xfe,0xff,0x40,0x22,0x20,0x10,0x40,0x2a,0x20,0x10,0x3e,0x02,0x01,0x00,0x44,0x22,0x20,0x10,0x44,0x2a,0x20,0x10,0x00,0x04,0x40,0x10,0x04
,0x04,0x40,0x10,0x08,0x04,0x40,0x10,0x0c,0x04,0x40,0x10,0x10,0x04,0x40,0x10,0x14,0x04,0x40,0x10,0x18,0x04,0x40,0x10,0xc1,0x01,0xc5,0x01,0x1c,0x04,0x40,0x10,0x20
,0x04,0x40,0x10,0x24,0x04,0x40,0x10,0x28,0x04,0x40,0x10,0x2c,0x04,0x40,0x10,0x30,0x04,0x40,0x10,0x34,0x04,0x40,0x10,0x38,0x04,0x40,0x10,0x3c,0x04,0x40,0x10,0x92
,0x01,0x96,0x01,0x40,0x04,0x40,0x10,0x44,0x04,0x40,0x10,0x48,0x04,0x40,0x10,0x90,0x01,0xf0,0x00,0x5c,0x04,0x40,0x10,0xd1,0x00,0xc1,0x01,0x60,0x04,0x40,0x10,0x02
,0x00,0x92,0x01,0x64,0x04,0x40,0x10,0x00,0x00,0x30,0x18,0x68,0x04,0x40,0x10,0x6c,0x04,0x40,0x10,0x41,0x03,0x08,0x00,0x70,0x04,0x40,0x10,0x01,0x05,0x01,0x00,0x74
,0x04,0x40,0x10,0x78,0x04,0x40,0x10,0x90,0x04,0x40,0x10,0x94,0x04,0x40,0x10,0x98,0x04,0x40,0x10,0x9c,0x04,0x40,0x10,0x84,0x04,0x40,0x10,0x00,0x01,0x01,0x01,0x01
,0x01,0x01,0x00,0x00,0x05,0x40,0x10,0x04,0x05,0x40,0x10,0x08,0x05,0x40,0x10,0x0c,0x05,0x40,0x10,0x10,0x05,0x40,0x10,0x14,0x05,0x40,0x10,0x18,0x05,0x40,0x10,0x1c
,0x05,0x40,0x10,0x20,0x05,0x40,0x10,0x24,0x05,0x40,0x10,0x28,0x05,0x40,0x10,0x2c,0x05,0x40,0x10,0x30,0x05,0x40,0x10,0x34,0x05,0x40,0x10,0x38,0x05,0x40,0x10,0x3c
,0x05,0x40,0x10,0x94,0x01,0x98,0x01,0x40,0x05,0x40,0x10,0x44,0x05,0x40,0x10,0x48,0x05,0x40,0x10,0x40,0x01,0xf0,0x00,0x5c,0x05,0x40,0x10,0x60,0x05,0x40,0x10,0x52
,0x00,0x92,0x01,0x64,0x05,0x40,0x10,0x00,0x65,0x34,0x18,0x68,0x05,0x40,0x10,0x00,0x65,0x44,0x18,0x6c,0x05,0x40,0x10,0x01,0x03,0x08,0x00,0x70,0x05,0x40,0x10,0x74
,0x05,0x40,0x10,0x78,0x05,0x40,0x10,0x90,0x05,0x40,0x10,0x9c,0x05,0x40,0x10,0x84,0x05,0x40,0x10,0x00,0xfe,0xff,0x23,0x04,0xfe,0xff,0x23,0x08,0xfe,0xff,0x23,0xf8
,0xff,0xff,0x1f,0x18,0x47,0xc0,0x46,0x5f,0x00,0x00,0x00,0x4c,0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x26,0x00,0x00,0x00};
const int screeninit_size=952;
44 changes: 44 additions & 0 deletions chainloader/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2))

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif

include $(DEVKITARM)/base_tools

name := $(shell basename $(CURDIR))

dir_source := source
dir_build := build
dir_out := ../$(dir_build)

ASFLAGS := -mcpu=arm946e-s
CFLAGS := -Wall -Wextra -marm $(ASFLAGS) -fno-builtin -std=c11 -Wno-main -O2 -flto -ffast-math
LDFLAGS := -nostartfiles -Wl,--nmagic

objects = $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \
$(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \
$(call rwildcard, $(dir_source), *.s *.c)))

.PHONY: all
all: $(dir_out)/$(name).bin

.PHONY: clean
clean:
@rm -rf $(dir_build)

$(dir_out)/$(name).bin: $(dir_build)/$(name).elf
$(OBJCOPY) -S -O binary $< $@

$(dir_build)/$(name).elf: $(objects)
$(LINK.o) -T linker.ld $(OUTPUT_OPTION) $^

$(dir_build)/memory.o: CFLAGS += -O3

$(dir_build)/%.o: $(dir_source)/%.c
@mkdir -p "$(@D)"
$(COMPILE.c) $(OUTPUT_OPTION) $<

$(dir_build)/%.o: $(dir_source)/%.s
@mkdir -p "$(@D)"
$(COMPILE.s) $(OUTPUT_OPTION) $<
21 changes: 21 additions & 0 deletions chainloader/linker.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)

ENTRY(_start)
SECTIONS
{
. = 0x01FF9000;

__start__ = ABSOLUTE(.);

.text : ALIGN(4) { *(.text.start) *(.text*); . = ALIGN(4); }
.rodata : ALIGN(4) { *(.rodata*); . = ALIGN(4); }
.data : ALIGN(4) { *(.data*); . = ALIGN(8); *(.bss* COMMON); . = ALIGN(8); }

. = ALIGN(4);

__end__ = ABSOLUTE(.);

__stack_top__ = 0x01FFB800;
__stack_bottom__ = 0x01FFA800;
}
31 changes: 31 additions & 0 deletions chainloader/source/cache.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* This file is part of Luma3DS
* Copyright (C) 2016-2017 Aurora Wright, TuxSH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/

#pragma once

#include "types.h"

void flushCaches(void);
60 changes: 60 additions & 0 deletions chainloader/source/cache.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@ This file is part of Luma3DS
@ Copyright (C) 2016-2017 Aurora Wright, TuxSH
@
@ This program is free software: you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation, either version 3 of the License, or
@ (at your option) any later version.
@
@ This program is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ GNU General Public License for more details.
@
@ You should have received a copy of the GNU General Public License
@ along with this program. If not, see <http://www.gnu.org/licenses/>.
@
@ Additional Terms 7.b and 7.c of GPLv3 apply to this file:
@ * Requiring preservation of specified reasonable legal notices or
@ author attributions in that material or in the Appropriate Legal
@ Notices displayed by works containing it.
@ * Prohibiting misrepresentation of the origin of that material,
@ or requiring that modified versions of such material be marked in
@ reasonable ways as different from the original version.

.text
.arm
.align 4

.global flushCaches
.type flushCaches, %function
flushCaches:
@ Clean and flush both the data cache and instruction caches

@ Adpated from http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0155a/ch03s03s05.html ,
@ and https://github.com/gemarcano/libctr9_io/blob/master/src/ctr_system_ARM.c#L39 as well
@ Note: ARM's example is actually for a 8KB DCache (which is what the 3DS has)

@ Implemented in bootROM at addresses 0xffff0830 (DCache) and 0xffff0ab4 (ICache)

mov r1, #0 @ segment counter
outer_loop:
mov r0, #0 @ line counter

inner_loop:
orr r2, r1, r0 @ generate segment and line address
mcr p15, 0, r2, c7, c14, 2 @ clean and flush the line
add r0, #0x20 @ increment to next line
cmp r0, #0x400
bne inner_loop

add r1, #0x40000000
cmp r1, #0
bne outer_loop

mcr p15, 0, r1, c7, c10, 4 @ drain write buffer

@ Flush instruction cache
mcr p15, 0, r1, c7, c5, 0

bx lr
42 changes: 42 additions & 0 deletions chainloader/source/firm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* This file is part of Luma3DS
* Copyright (C) 2016-2017 Aurora Wright, TuxSH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/

#include "firm.h"
#include "memory.h"
#include "cache.h"

void disableMpuAndJumpToEntrypoints(int argc, char **argv, void *arm11Entry, void *arm9Entry);

void launchFirm(Firm *firm, int argc, char **argv)
{
//Copy FIRM sections to respective memory locations
for(u32 sectionNum = 0; sectionNum < 4; sectionNum++)
memcpy(firm->section[sectionNum].address, (u8 *)firm + firm->section[sectionNum].offset, firm->section[sectionNum].size);

disableMpuAndJumpToEntrypoints(argc, argv, firm->arm9Entry, firm->arm11Entry);

__builtin_unreachable();
}
Loading