Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc50d5f

Browse files
committed
Fixes for latest LiteX
1 parent d013077 commit dc50d5f

File tree

12 files changed

+70
-38
lines changed

12 files changed

+70
-38
lines changed

FemtoRV/FIRMWARE/EXAMPLES/ST_NICCC_spi_flash.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ uint16_t cmap[16];
9494
* Current frame's vertices coordinates (if frame is indexed),
9595
* mapped to OLED display dimensions (divide by 2 from file).
9696
*/
97-
uint8_t X[255];
98-
uint8_t Y[255];
97+
uint8_t X[256];
98+
uint8_t Y[256];
9999

100100
/*
101101
* Current polygon vertices, as expected
102102
* by GL_fill_poly():
103103
* xi = poly[2*i], yi = poly[2*i+1]
104104
*/
105-
int poly[30];
105+
int poly[40];
106106

107107
int wireframe = 0;
108108

@@ -146,10 +146,10 @@ int read_frame() {
146146
}
147147

148148
if(wireframe) {
149-
GL_clear();
149+
// GL_clear();
150150
} else {
151151
if(frame_flags & CLEAR_BIT) {
152-
// GL_clear(); // Commented out, too much flickering,
152+
// GL_clear(); // Commented out, too much flickering,
153153
// cannot VSync on the OLED display.
154154
}
155155
}
@@ -202,21 +202,30 @@ int read_frame() {
202202
return 1;
203203
}
204204

205+
void print_frame(int frame) {
206+
GL_tty_goto_xy(0,0);
207+
printf("%d",frame);
208+
}
205209

206210
int main() {
211+
int frame;
207212
GL_init(GL_MODE_OLED);
208213
GL_clear();
209214
MAX7219_tty_init();
210215
printf("3.2.1.GO!! ");
216+
217+
GL_tty_init(GL_MODE_OLED);
211218

212219
wireframe = 0;
213-
214220
for(;;) {
221+
frame=0;
215222
spi_reset();
216223
GL_polygon_mode(wireframe ? GL_POLY_LINES: GL_POLY_FILL);
217224
while(read_frame()) {
218-
// delay(50); // If GL_clear() is uncommented, uncomment as well
219-
// to reduce flickering.
225+
print_frame(frame);
226+
++frame;
227+
// delay(10); // If GL_clear() is uncommented, uncomment as well
228+
// // to reduce flickering.
220229
}
221230
wireframe = !wireframe;
222231
}

LiteX/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.
3737
$ chmod +x litex_setup.py
3838
$ ./litex_setup.py --init --install --user
3939
$ pip3 install meson ninja
40-
$ ./litex_setup.py --gcc=riscv
40+
$ sudo ./litex_setup.py --gcc=riscv
4141
```
4242

4343
Synthesize

LiteX/boards/radiona_ulx3s_ex.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,31 @@
1111
import argparse
1212
import sys
1313

14+
import migen
1415
from migen import *
1516

1617
from litex.build.generic_platform import *
1718
from litex.build.lattice import LatticePlatform
18-
from litex_boards.platforms import ulx3s as ulx3s_platform
19-
from litex_boards.targets import ulx3s
19+
from litex_boards.platforms import radiona_ulx3s as ulx3s_platform
20+
from litex_boards.targets import radiona_ulx3s
21+
from litex.gen import *
2022

2123
#--------------------------------------------------------------------------------------------------------
2224

2325
# Add wifi_en pin to ULX3S platform (to activate / deactivate ESP32)
2426
# Quick-and-dirty hack: replace Platform constructor and add the missing pin
27+
# --> Not needed anymore, it is there (called "wifi_gpio0")
28+
#
29+
#def new_platform_init(self, device="LFE5U-45F", revision="2.0", toolchain="trellis", **kwargs):
30+
# assert device in ["LFE5U-12F", "LFE5U-25F", "LFE5U-45F", "LFE5U-85F"]
31+
# assert revision in ["1.7", "2.0"]
32+
# _io = ulx3s_platform._io_common + \
33+
# {"1.7": ulx3s_platform._io_1_7, "2.0": ulx3s_platform._io_2_0}[revision] + \
34+
# [("wifi_en", 0, Pins("F1"), IOStandard("LVCMOS33"), Misc("PULLMODE=UP"), Misc("DRIVE=4"))]
35+
# LatticePlatform.__init__(self, device + "-6BG381C", _io, toolchain=toolchain, **kwargs)
36+
#
37+
#ulx3s_platform.Platform.__init__ = new_platform_init
2538

26-
def new_platform_init(self, device="LFE5U-45F", revision="2.0", toolchain="trellis", **kwargs):
27-
assert device in ["LFE5U-12F", "LFE5U-25F", "LFE5U-45F", "LFE5U-85F"]
28-
assert revision in ["1.7", "2.0"]
29-
_io = ulx3s_platform._io_common + \
30-
{"1.7": ulx3s_platform._io_1_7, "2.0": ulx3s_platform._io_2_0}[revision] + \
31-
[("wifi_en", 0, Pins("F1"), IOStandard("LVCMOS33"), Misc("PULLMODE=UP"), Misc("DRIVE=4"))]
32-
LatticePlatform.__init__(self, device + "-6BG381C", _io, toolchain=toolchain, **kwargs)
33-
34-
ulx3s_platform.Platform.__init__ = new_platform_init
3539

3640
#--------------------------------------------------------------------------------------------------------
3741

@@ -46,7 +50,7 @@ def new_platform_init(self, device="LFE5U-45F", revision="2.0", toolchain="trell
4650
class ESP32(Module, AutoCSR):
4751
def __init__(self, platform):
4852
self._enable = CSRStorage()
49-
self.comb += platform.request("wifi_en").eq(self._enable.storage)
53+
self.comb += platform.request("wifi_gpio0").eq(self._enable.storage) # HERE: "wifi_en"
5054

5155
# Blitter -----------------------------------------------------------------------------------------------
5256
# For now, it just has fast memory fill
@@ -62,13 +66,13 @@ def __init__(self,port): # for instance, port = soc.sdram.crossbar.get_port()
6266

6367
# BaseSoC -----------------------------------------------------------------------------------------------
6468

65-
class BaseSoC(ulx3s.BaseSoC):
69+
class BaseSoC(radiona_ulx3s.BaseSoC):
6670
def __init__(self, device="LFE5U-45F", revision="2.0", toolchain="trellis",
6771
sys_clk_freq=int(50e6), sdram_module_cls="MT48LC16M16", sdram_rate="1:1",
6872
with_led_chaser=True, with_video_terminal=False, with_video_framebuffer=False,
6973
with_spi_flash=False, **kwargs):
7074

71-
ulx3s.BaseSoC.__init__(
75+
radiona_ulx3s.BaseSoC.__init__(
7276
self, device, revision, toolchain, sys_clk_freq, sdram_module_cls, sdram_rate,
7377
with_led_chaser, with_video_terminal, with_video_framebuffer, with_spi_flash,
7478
**kwargs)
@@ -119,6 +123,7 @@ def main():
119123
**soc_core_argdict(args))
120124

121125
soc.add_spi_sdcard(with_tristate=True)
126+
# soc.add_spi_sdcard()
122127
if args.with_oled:
123128
soc.add_oled()
124129

LiteX/software/DemoBundle/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# (for instance, LiteX/build/radiona_ulx3s)
44
# Alternatively you can edit this file and change LITEX_DIR and
55
# LITEX_PLATFORM below.
6-
# 2) lxterm /dev/ttyUSBnnn --kernel demo.bin
6+
# 2) litex_term /dev/ttyUSBnnn --kernel demo.bin
77
# 3) litex> reboot
88

99
include ../makefile.inc

LiteX/software/DemoBundle/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int main(int i, char **c)
7272
printf(" BIOS built on "__DATE__" "__TIME__"\n");
7373
#endif
7474
printf("\n");
75-
printf(" Migen git sha1: "MIGEN_GIT_SHA1"\n");
75+
// printf(" Migen git sha1: "MIGEN_GIT_SHA1"\n");
7676
printf(" LiteX git sha1: "LITEX_GIT_SHA1"\n");
7777
printf("\n");
7878
printf("--=============== \e[1mSoC\e[0m ==================--\n");

LiteX/software/Libs/imgui/imgui_sw.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@
44
// license: you are granted a perpetual, irrevocable license to copy, modify,
55
// publish, and distribute this file as you see fit.
66

7-
#include "imgui_sw.h"
8-
#include "imgui.h"
97
extern "C" {
108
#include "lite_fb.h"
119
}
1210

11+
#ifdef min
12+
#undef min
13+
#endif
14+
15+
#ifdef max
16+
#undef max
17+
#endif
18+
19+
#include "imgui_sw.h"
20+
#include "imgui.h"
21+
1322
#include <math.h>
1423
#include <stdio.h>
1524

LiteX/software/Libs/lite_fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void fb_fillrect(
209209
#define BOTTOM 4
210210
#define TOP 8
211211

212-
#define code(x,y) ((x) < fb_clip_x1) | (((x) > fb_clip_x2)<<1) | (((y) < fb_clip_y1)<<2) | (((y) > fb_clip_y2)<<3)
212+
#define code(X,Y) ((X) < fb_clip_x1) | (((X) > fb_clip_x2)<<1) | (((Y) < fb_clip_y1)<<2) | (((Y) > fb_clip_y2)<<3)
213213

214214
void fb_line(int x1, int y1, int x2, int y2, uint32_t RGB) {
215215

LiteX/software/LiteOS/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ boot.elf: $(OBJECTS) libliteos.a
2323
-N -o $@ \
2424
$(OBJECTS) \
2525
$(PACKAGES:%=-L$(BUILD_DIR)/software/%) \
26-
$(LIBS:lib%=-l%) -L. -lliteos
26+
$(LIBS:lib%=-l%) -L. -lliteos
2727
chmod -x $@
2828

2929
# Made crt0.o dependent on one of the generated files to make sure it

LiteX/software/LiteOS/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int main(int i, char **c)
9999
printf(" BIOS built on "__DATE__" "__TIME__"\n");
100100
#endif
101101
printf("\n");
102-
printf(" Migen git sha1: "MIGEN_GIT_SHA1"\n");
102+
// printf(" Migen git sha1: "MIGEN_GIT_SHA1"\n");
103103
printf(" LiteX git sha1: "LITEX_GIT_SHA1"\n");
104104
printf("\n");
105105
printf("--=============== \e[1mSoC\e[0m ==================--\n");

LiteX/software/Programs/tinyraytracer.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
#include <math.h>
1515
#include <string.h>
1616

17+
#ifdef min
18+
#undef min
19+
#endif
20+
21+
#ifdef max
22+
#undef max
23+
#endif
24+
1725
/*******************************************************************/
1826

1927
typedef int BOOL;

0 commit comments

Comments
 (0)