Commit Graph
629 Commits
Author SHA1 Message Date
logicog 855383052b Fix uip.c 2026-03-09 22:06:57 +01:00
logicog acaa80b732 Make dhcpd server implementation available 2026-03-09 22:06:57 +01:00
logicog 233ff5a728 Initial support for dhcp server 2026-03-09 22:06:57 +01:00
René van Dorst c2f5a91763 Merge pull request #150 from logicog/bandwidth_web
Bandwidth web
2026-03-09 19:54:31 +00:00
logicog ed8dc0f43c Fix bug in atoi_hex when uneven number of digits parsed
We fix a bug in atoi_hex when parsing an unneven number of digits
by rotating the entire number 4 bits right as would have been
done if the number had been preceded by a 0 to make the number
of digits even.
2026-03-09 06:48:24 +01:00
logicog 7949975191 Add backend support for bandwidth control 2026-03-08 20:55:50 +01:00
logicog 1374272db6 Add simulation support for bandwidth control 2026-03-08 20:55:50 +01:00
logicog 20fb626cc1 Make bandwidth control page accessible 2026-03-08 20:55:50 +01:00
logicog 31a488e4e9 Add web page for bandwidth control 2026-03-08 20:55:50 +01:00
logicog 14bc823024 Add reg_bit_test function 2026-03-08 20:55:50 +01:00
René van Dorst 87c161dc70 Merge pull request #147 from logicog/bandwidth
Bandwidth control
2026-03-08 19:46:51 +00:00
logicog 04ab083652 Add documentation for bandwidth control 2026-03-08 19:04:48 +01:00
logicog 1836c7dcb6 Add Bandwidth control for ingress/egreess at port 2026-03-08 19:04:48 +01:00
René van Dorst e33cd9d0c5 Merge pull request #143 from feelfree69/flashsize_web
Show flash_size to web interface and console
2026-03-06 18:22:48 +00:00
feelfree69 71880a95f5 optimization as suggested by review comment 2026-03-06 08:55:59 +01:00
feelfree69 494320b191 Resolve review comments 2026-03-05 08:55:51 +01:00
logicog eb13d4ab04 Add iniital implementation of bandwidth control 2026-03-05 07:43:11 +01:00
René van Dorst a15500c493 Merge pull request #146 from ranma/printopt
Optimize printing functions
2026-03-02 20:59:26 +00:00
logicog a89467febc Merge pull request #144 from ranma/xpage
Add DW8051 MPAGE SFR
2026-03-01 18:55:43 +01:00
logicog 706abcf78d Merge pull request #145 from ranma/libc-main-vectors
Rename bootloader to main
2026-03-01 17:53:56 +01:00
Tobias Diedrich c868482669 Rename bootloader to main
The presence of the main function is a hardcoded trigger in sdcc that causes
the interrupt vectors and atomic rollback helpers to be generated as part of
compilation of the file containing the main function.

This makes sure the runtime library is correctly initialized and reduces
crtstart.asm to contain only the banked call helpers.

To ensure that the __interrupt_vect in area HOME is located at the beginning
of the firmware, the linker flags are updated to set the HOME start to
0x00000 and the linker object order is modified to have rtlplayground.rel
first.

Generated code in rtlplayground.asm:
```
;--------------------------------------------------------
; interrupt vector
;--------------------------------------------------------
	.area HOME    (CODE)
__interrupt_vect:
	ljmp	__sdcc_gsinit_startup
	ljmp	_isr_ext0
	.ds	5
	ljmp	_isr_timer0
	.ds	5
	ljmp	_isr_ext1
	.ds	5
	reti
	.ds	7
	ljmp	_isr_serial
	.ds	5
	ljmp	_isr_timer2
	.ds	5
	reti
	.ds	7
	reti
	.ds	7
	ljmp	_isr_ext2
	.ds	5
	ljmp	_isr_ext3
; restartable atomic support routines
	.ds	2
sdcc_atomic_exchange_rollback_start::
	nop
	nop
sdcc_atomic_exchange_pdata_impl:
	movx	a, @r0
	mov	r3, a
	mov	a, r2
	movx	@r0, a
	sjmp	sdcc_atomic_exchange_exit
	nop
	nop
sdcc_atomic_exchange_xdata_impl:
	movx	a, @dptr
	mov	r3, a
	mov	a, r2
	movx	@dptr, a
	sjmp	sdcc_atomic_exchange_exit
sdcc_atomic_compare_exchange_idata_impl:
	mov	a, @r0
	cjne	a, ar2, .+#5
	mov	a, r3
	mov	@r0, a
	ret
	nop
sdcc_atomic_compare_exchange_pdata_impl:
	movx	a, @r0
	cjne	a, ar2, .+#5
	mov	a, r3
	movx	@r0, a
	ret
	nop
sdcc_atomic_compare_exchange_xdata_impl:
	movx	a, @dptr
	cjne	a, ar2, .+#5
	mov	a, r3
	movx	@dptr, a
	ret
sdcc_atomic_exchange_rollback_end::

sdcc_atomic_exchange_gptr_impl::
	jnb	b.6, sdcc_atomic_exchange_xdata_impl
	mov	r0, dpl
	jb	b.5, sdcc_atomic_exchange_pdata_impl
sdcc_atomic_exchange_idata_impl:
	mov	a, r2
	xch	a, @r0
	mov	dpl, a
	ret
sdcc_atomic_exchange_exit:
	mov	dpl, r3
	ret
sdcc_atomic_compare_exchange_gptr_impl::
	jnb	b.6, sdcc_atomic_compare_exchange_xdata_impl
	mov	r0, dpl
	jb	b.5, sdcc_atomic_compare_exchange_pdata_impl
	sjmp	sdcc_atomic_compare_exchange_idata_impl
```
2026-03-01 17:35:13 +01:00
Tobias Diedrich 9bd2d446d7 Optimize printing functions
This saves 508 bytes in the HOME area by:
- Getting rid of the expensive hex array indexing
- Having print_short and print_long delegate to print_byte

This is at the expense of increasing the stack depth a tiny bit.
Stack usage isn't an issue so far since I see ~96 bytes of
untouched stack memory.
2026-03-01 12:45:31 +01:00
Tobias Diedrich c3a6a46852 Add DW8051 MPAGE SFR
This adds the MPAGE (sdcc _XPAGE) SFR, which is used by sdcc in `--xstack`
mode to provide the upper byte of the address for `MOVX A, @Ri` and
`MOVX @Ri, A` instructions.

Classic 8051 uses the P2 SFR value for this, but the RTL IP block does not
seem to be using the "Port 2 module".

From the databook:
```
To replace the function of the Port 2 latch in designs that do not use a
Port 2 module, the DW8051 provides an additional special function register,
MPAGE, at SFR address 92h. During MOVX A, @Ri and MOVX @Ri, A instructions,
the DW8051 places the contents of the MPAGE register on the upper 8 address
bits (mem_addr[15:8]). This provides the paging function that is normally
provided by the Port 2 latch. The MPAGE register has no function when a
Port 2 module is used to connect external RAM.
```
2026-03-01 09:32:13 +01:00
feelfree69 7a0f248424 Add flash_size to web interface 2026-02-28 19:56:18 +01:00
logicog 23e2f5a99e Merge pull request #140 from feelfree69/flashsize
Check for sufficient flashsize before applying an update
2026-02-28 11:48:38 +01:00
René van Dorst 81a7393a81 Merge pull request #141 from logicog/SWTG018AS_A_V_2_0
Add support for the SWTG018AS-A V2.0 8+1 unmanged switch
2026-02-27 19:30:25 +00:00
logicog dc16b25d62 Add support for the SWTG018AS-A V2.0 8+1 unmanged switch
The SWTG018AS-A V2.0 is an 8x2.5GBit/s port + 1 SFP+ port unmanged device
It is sold in an unbranded casing e.g. by Ampcom.
Hardware:
SoC: RTL8373N
Additional PHY: RTL8224
Flash: Puya P25D40SH (4MBit, slimmer, not standard SOP-8 package!)
LEDs: 1 Green + 1 Orange per Ethernet port (green designates 2.5GBit)
      1 Green LED for the SFP+ port

The photos already show a modified PCB: Unpopulated resistors R52 and R53
have been bridged in order to enable the serial console. The smaller flash
memory chip at U2 has been replaced with a Windbond 128MBit standard-sized
SOIC-8 chip in order to easily use SOIC clamps to flash the device. Also
the serial header has been populated.
2026-02-27 20:11:53 +01:00
feelfree69 ffbd2c512d Check for sifficient flashsize before applying an update 2026-02-25 18:51:00 +01:00
René van Dorst ba18fa19b0 Merge pull request #138 from logicog/kp_9000_x6hml_x2
Add device photos of KeepLink KP-9000-6XHML-X2
2026-02-25 17:45:53 +00:00
logicog 70127018da Add device photos of KeepLink KP-9000-6XHML-X2 2026-02-25 18:07:54 +01:00
feelfree69 e26a9e3db9 Merge pull request #93 from logicog/cmdbuf
Add support for command line editing
2026-02-25 15:55:41 +01:00
René van Dorst d29d7dcf98 Merge pull request #139 from logicog/fix_6xhml_reset
Fix reset button GPIO-Number for MACHINE_KP_9000_6XHML_X2
2026-02-25 08:28:28 +01:00
logicog 734cce381a Fix reset button GPIO-Number for MACHINE_KP_9000_6XHML_X2 2026-02-25 06:28:49 +01:00
logicog dfc96761b3 Add support for history editing 2026-02-24 19:57:22 +01:00
logicog 94d4ace88b Add support for command line editing
The current code for entering commands via the serial CLI is completely
refactored and moved out of rtlplayground.c into a separate file cmd_edit.c
putting code into BANK2.
The serial ring buffer sbuf[] is now exclusively used for receiving
keys, including escape sequences (DEL will generate a 4-byte escape
sequence). The command is now held in cmd_buffer. This reduces
XMEM use, because the serial buffer can be much smaller.

Supported is only editing the current command line via backspace, del,
cursor left and right.

Because the code cannot distinguish escape sequences which are not yet
complete (because the serial isr has not yet put all characters into
the serial buffer) from the dozens of unsupported ones (F-keys/home,
Page up/down, cursor up/down...) they are ignored and remain in the
serial buffer until the ring-pointer overwrites them. This is standard
behaviour for consoles, which will print out garbage for unsupported
characters. In this implementation, the command line buffer and the
visible command line in the terminal are always synced, so garbage
can be removed again by ediing the line.

The code makes several redundant checks in order to prevent race-conditions
between the serial ISR and the comand-editing code.
2026-02-24 19:57:22 +01:00
logicog 284b2b003d Merge pull request #127 from feelfree69/resetbutton
Add button handling with the possibility to revert to default settings
2026-02-23 21:01:14 +01:00
logicog 68a8a9ee92 Merge pull request #128 from vDorst/doc_mods_fix
docs: mods: Fix MiB numbers.
2026-02-23 07:46:54 +01:00
logicog 0045a74df0 Merge pull request #102 from TylerDurden-23/opt-system-settings
Add startup config editor to system settings menu
2026-02-16 20:53:52 +01:00
feelfree69 0bdb238c0a Check fir button presses once a second 2026-02-15 16:42:18 +01:00
René van Dorst 033616ef63 Merge pull request #130 from MaDill/patch-1
Update README.md how to compile
2026-02-15 15:38:45 +00:00
René van Dorst a57aeda053 Merge pull request #132 from feelfree69/default_machine
fix `make MACHINE=DEFAULT_8C_1SFP`
2026-02-15 15:22:12 +00:00
feelfree69 556899d346 fix make MACHINE=DEFAULT_8C_1SFP 2026-02-15 14:05:49 +01:00
MaDill cc734ecac2 Update README.md
changed as requested
2026-02-15 14:02:37 +01:00
feelfree69 e5d23f11de Demagic FLASH_BUF_SIZE 2026-02-15 13:28:31 +01:00
feelfree69 3c648d5936 Fix messed up merge commit; add button user feedback via sysled 2026-02-15 13:01:22 +01:00
feelfree69 4658667459 fix compiler warning 2026-02-15 13:00:02 +01:00
feelfree69 e966b153af Merge branch 'main' into resetbutton 2026-02-15 12:34:46 +01:00
feelfree69 5ecd0e6a32 revert changing machine.h 2026-02-15 12:15:06 +01:00
René van Dorst d8b52d50de Merge pull request #131 from vDorst/fix_github_action
Fix GitHub actions build and select machine-type via variable.
2026-02-15 11:08:18 +00:00
René van Dorst 1f6f7fbcd4 Fix GITHUB action build.
PR #119 made that no machine-type is selected, so the build will fail.
commit 2f787fee enables us select a machine via a variable, use this to
select a machine-type `KP_9000_6XHML_X2` to build.
2026-02-15 11:25:47 +01:00