Skip to content

Commit 3302dc6

Browse files
committed
Update 99_developer_guide.md
Add debug example. Improve tips. Improvements for readability.
1 parent 4a8cd35 commit 3302dc6

File tree

1 file changed

+51
-22
lines changed

1 file changed

+51
-22
lines changed

docs/99_developer_guide.md

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[Return to the index](./00_index.md)
22
## Developer Guide
33

4-
You can use a dev container in VSCode to ease development.
4+
> [!TIP]
5+
> You should use the pre-configured dev container in VSCode to ensure easy development.
56
67
Expected pre-requsites:
78
* [Docker](https://docs.docker.com/engine/install/) or [Podman](https://podman.io/docs/installation) container environment (for dev container support).
@@ -10,23 +11,35 @@ Expected pre-requsites:
1011
### A quick start video tutorial on how to set up your environment
1112
[![Docker Devcontainer quick start guide](http://img.youtube.com/vi/h05ufOsRgZU/0.jpg)](http://www.youtube.com/watch?v=h05ufOsRgZU "Docker Devcontainer quick start guide").
1213

14+
## How to build the ROM
15+
In the terminal, use make directly, i.e.: `make all`.
16+
The ROMs can be found in the `output` directory.
17+
18+
For the future:
19+
`ms-vscode.makefile-tools` will hopefully help (installed automatically in dev container).
20+
NOTE: it does not yet work with `F5`: see [this blog post](https://devblogs.microsoft.com/cppblog/now-announcing-makefile-support-in-visual-studio-code/).
1321

14-
### How to deploy
15-
#### SC64
16-
* Download the deployer [here](https://github.com/Polprzewodnikowy/SummerCart64/releases/download/v2.20.2/sc64-deployer-windows-v2.20.2.zip).
17-
* Extract and place `sc64deployer.exe` in the `tools/sc64` directory.
1822

23+
## How to deploy and/or debug to the SC64
1924
Make sure that your firmware is compatible (currently v2.20.2+).
2025
See: [here](https://github.com/Polprzewodnikowy/SummerCart64/blob/v2.20.2/docs/00_quick_startup_guide.md#firmware-backupupdate)
2126

22-
##### From the devcontainer
23-
It is not currently possible to directly communicate with USB devices. BUT, you can use a proxy TCP/IP connection as a workaround.
24-
To set up a proxy, open a terminal window, `cd ./tools/sc64` and then `./sc64deployer.exe server`.
27+
You will need to download a copy of the `sc64deployer` from [here](https://github.com/Polprzewodnikowy/SummerCart64/releases/download/v2.20.2/) or build your own depending on the scenario.
28+
29+
> [!TIP]
30+
> Toggle the N64 POWER switch to load and run the ROM.
31+
32+
### From within the devcontainer
33+
#### To the native OS
34+
It is not currently possible to directly communicate with USB devices from a devcontainer. BUT, you can use a proxy TCP/IP connection as a workaround.
35+
To set up a "proxy", open a terminal window on the native OS, then `cd ./tools/sc64` and then `./sc64deployer.exe server`.
36+
Keep this terminal window open.
2537

2638
Then, in the dev container, use `make run` or `make run-debug`.
2739

40+
#### To a remote LAN device
2841
If you want to Deploy and debug to a fully remote target (over your LAN)
29-
Make sure that the remote target has the server running:
42+
Make sure that the remote target device (i.e. the one with the carts USB connected) has the server running (similar as specified in To the native OS, but):
3043

3144
> [!TIP]
3245
> Make sure you specify its accessible IP and port.
@@ -38,35 +51,51 @@ Make sure that the remote target has the server running:
3851

3952
The following commands can then be run from the docker environment terminal:
4053

54+
To upload and run the ROM (requires power toggle):
4155
```
42-
sc64deployer --remote [THE_LAN_IP_ADDRESS]:9064 upload ./output/N64FlashcartMenu.n64
43-
sc64deployer --remote [THE_LAN_IP_ADDRESS]:9064 debug --no-writeback --init "send-file /sc64menu.n64 @output/sc64menu.n64@;reboot"
56+
REMOTE=[THE_LAN_IP_ADDRESS]:9064 make run
4457
```
4558

59+
To debug the ROM:
60+
```
61+
REMOTE=[THE_LAN_IP_ADDRESS]:9064 make run-debug
62+
```
4663

47-
##### From your host (Windows) OS
48-
49-
* Run `./localdeploy.bat` from the terminal.
50-
51-
Toggle the N64 POWER switch to load the ROM.
64+
### Directly From your host (Windows) OS
65+
* Download the deployer [here](https://github.com/Polprzewodnikowy/SummerCart64/releases/download/v2.20.2/sc64-deployer-windows-v2.20.2.zip).
66+
* Extract and place `sc64deployer.exe` in the `tools/sc64` directory.
67+
* Then use `make run` or `make run-debug` in the terminal.
5268

53-
`ms-vscode.makefile-tools` will help (installed automatically in dev container).
54-
NOTE: it does not yet work with `F5`: see [this blog post](https://devblogs.microsoft.com/cppblog/now-announcing-makefile-support-in-visual-studio-code/).
55-
WORKAROUND: in the dev container terminal, use make directly, i.e.: `make`.
56-
The ROM can be found in the `output` directory.
5769

70+
### To an SD Card
5871
NOTE: A "release" version of the SC64 menu is called `sc64menu.n64` and can be generated by running `make all` or running `make sc64`. You can then copy the resulting `sc64menu.n64` file to your SD card.
5972

60-
#### Ares Emulator
73+
74+
## How to deploy and/or debug to other flashcarts/emulators
75+
### Ares Emulator
6176
For ease of development and debugging, the N64FlashcartMenu ROM can run in the [Ares emulator](https://ares-emu.net/) (without most flashcart features).
6277

6378
* Ensure you have the Ares emulator on your computer.
6479
* Load the `N64FlashcartMenu.n64` ROM.
6580

66-
#### Others
81+
### Others
6782
* Add the required file to the correct folder on your SD card.
6883

6984

85+
## How to add debug code
86+
Within the code, use the `debugf` command, and then deploy using a debug build e.g. `make run-debug`.
87+
88+
```c
89+
debugf("joybus_rtc_detect_async: %s %s %s %s\n",
90+
detected ? "detected" : "not detected",
91+
status.stopped ? "stopped" : "running",
92+
status.crystal_bad ? "crystal:BAD" : "crystal:OK",
93+
status.battery_bad ? "battery:BAD" : "battery:OK"
94+
);
95+
```
96+
The output will then be shown within the terminal.
97+
98+
7099
## Update submodules
71100
To update to the latest version, use `git submodule update --remote` from the terminal.
72101

0 commit comments

Comments
 (0)