Getting closer w/ flash & illumination

master
kaqu 2 years ago
parent f126ec28c0
commit ac3ffe2683
  1. 6
      .vscode/launch.json
  2. 2
      bit_to_flash.py
  3. 23
      firmware/main.c
  4. 3
      neopixelar.py

@ -9,14 +9,14 @@
"type": "python",
"request": "launch",
"program": "${file}",
"args": [//"--build",
"--flash",
"args": ["--build",
//"--flash",
"--revision=7.0",
"--uart-name=crossover",
"--with-etherbone",
"--ip-address=192.168.1.20",
"--csr-csv=build/csr.csv", // Only this one for remotetest.py!
//"--doc"
"--doc"
],
//"args": ["--build"],
//"pythonArgs": ["--build", "--uart-name=crossover"],

@ -39,7 +39,7 @@ def bit2svf(bitfilename, svffilename):
print("IDCODE in bitstream is 0x%08x" % idcode)
bitf.seek(0)
address = 0
address = 0xc0000000 # Was:0?! csr.csv -> memory_region spiflash @ 0xc0000000
last_page = -1
with open(svffilename, 'w') as svf:

@ -68,19 +68,10 @@ static void boot_sequence(void)
}
}
long mysleep(long delayms)
{
long r = 0l;
for(long l=0;l<delayms;l++)
for(long m=0;m<0xFFFFFFl;m++)
for(long n=0;n<0xFFFFFFl;n++)
r += (long)(m*l/(m * m))*n;
return r;
}
int main(int i, char **c)
{
extern void busy_wait(unsigned int ms);
char buffer[CMD_LINE_BUFFER_SIZE];
char *params[MAX_PARAM];
char *command;
@ -93,9 +84,8 @@ int main(int i, char **c)
int32_t red = 0x000100;
int32_t blue = 0x000001;
for(int j=0;j<1000;j++) {
for(int i=0;i<27;i+=3)
{
for(int j=0;j<24;j++) {
for(int i=0;i<27;i+=3) {
npe_b8LoadOffset_write(i); // @Offset
npe_b24Data2Load_write(green); // G
npe_b8LoadOffset_write(i+1); // @Offset
@ -107,11 +97,12 @@ int main(int i, char **c)
npe_b8Len_write(27); // Length
npe_bEnable_write(1); // Enable!
}
mysleep(100000); // 100ms or so ... ;)
busy_wait(200); // 100ms or so ... ;)
green <<= 1, red <<= 1, blue <<=1; // Increase intensity
if((green & 0xff0000) == 0) // High bit gone missing?
green = 1, red = 1, blue = 1; // Yap, reload!
}
busy_wait(400);
for(int i=0;i<27;i+=3)
{ //
npe_b8LoadOffset_write(i); // @Offset
@ -121,6 +112,8 @@ int main(int i, char **c)
npe_b8LoadOffset_write(i+2); // @Offset
npe_b24Data2Load_write(0); // B
}
busy_wait(1000);
npe_bEnable_write(0); // Disable
// end of illumination logic -----------------------------
#ifdef CONFIG_CPU_HAS_INTERRUPT

@ -412,8 +412,7 @@ def main():
if args.flash: # Convert Bit File to Jtag Write Flash command
name = os.path.join(builder.gateware_dir, soc.build_name)
print(f"Executing ./bit_to_flash.py {name}.bit {name}.svf.flash")
#os.system(f"./bit_to_flash.py {name}.bit {name}.svf.flash")
print(f"Executing ./bit_to_flash.py {name}.bit {name}.svf.flash")
from bit_to_flash import bit2svf
bit2svf(name + ".bit", name + ".svf.flash")
load(name + ".svf.flash")

Loading…
Cancel
Save