Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cr52 serial ethernet drivers #150

Merged
merged 24 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9fba032
Spider: Add serial communication support
fsylvestre Jun 9, 2023
02c97c7
Spider: Add serial example
fsylvestre Jun 9, 2023
44532b6
irq: adding support for ethernet interrupts
valeriosetti Jun 6, 2023
58284b0
example: adding sample code for ethernet
valeriosetti Jun 6, 2023
68529cd
minor code improvements
valeriosetti Jun 7, 2023
b37cd99
rswitch: initial support (WIP)
valeriosetti Jun 13, 2023
291a1b1
rswitch_regs: use secure APB accesses instead of the normal one
valeriosetti Jun 28, 2023
6cc46b2
phy: fix MII access
valeriosetti Jul 3, 2023
683e5e7
debug: add printf capability
valeriosetti Jul 4, 2023
7ef5dfa
eth: fixes for bringup
valeriosetti Jul 4, 2023
86edffd
debug: add function to print raw buffer
valeriosetti Jul 12, 2023
ee3e7bc
rswitch: properly manage RX interrupt
valeriosetti Jul 12, 2023
00d9c47
rswitch: adding support for transmission
valeriosetti Jul 12, 2023
23eed01
lwip: add submodule
valeriosetti Sep 5, 2023
23bf5a8
lwip: integrate into example project
valeriosetti Sep 5, 2023
934eb58
spider: move lwip-port/ethernet files in driver folder for spider board
fsylvestre Sep 22, 2023
950a668
spider: define 'ethernet' and 'lwip' libraries
fsylvestre Nov 10, 2023
83e48b0
spider: fix utils.h/printf.h files to use correct headers
fsylvestre Sep 22, 2023
d5df422
spider: fix ms_delay() function
fsylvestre Sep 22, 2023
dd25bb1
spider: update 'rswitch.c' to manage ISR outside of ISR() context.
fsylvestre Sep 22, 2023
0cfa5d5
spider: update ethernet example to use 'lwip' Trampoline library
fsylvestre Sep 22, 2023
570ea98
spider: add lwip support of Trampoline OS, without the needs to defin…
fsylvestre Sep 22, 2023
62d47e9
spider: add lwip example with NO_SYS undefined
fsylvestre Sep 21, 2023
4d0063f
spider: basic ethernet example (without lwip use) that answer to ping…
fsylvestre Sep 21, 2023
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "machines/riscv/pulpino/pulpino"]
path = machines/riscv/pulpino/pulpino
url = https://github.com/Instrumented-Pulpino/pulpino.git
[submodule "libraries/net/ethernet/lwip"]
path = libraries/net/ethernet/lwip
url = https://git.savannah.nongnu.org/git/lwip.git
15 changes: 15 additions & 0 deletions examples/cortex-a-r/armv8/spider/ethernet/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

#stop on errors
set -e

if [[ ! -d "_build" ]]
then
mkdir _build
fi

echo "*** Run Goil ***"
goil --target=cortex-a-r/armv8/spider --templates=../../../../../goil/templates/ eth.oil

echo "*** Run Make ***"
./make.py
94 changes: 94 additions & 0 deletions examples/cortex-a-r/armv8/spider/ethernet/eth.oil
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
OIL_VERSION = "4.0";

IMPLEMENTATION trampoline {
TASK {
UINT32 STACKSIZE = 2048 ;
} ;

ISR {
UINT32 STACKSIZE = 2048 ;
} ;
};

CPU eth {
OS config {
STATUS = EXTENDED;

BUILD = TRUE {
TRAMPOLINE_BASE_PATH = "../../../../..";
APP_SRC = "main.c";
APP_NAME = "eth_exe.elf";
CFLAGS = "-O0 -g -DHSCIF_1843200BPS -DNO_SYS";
LDFLAGS = "-Map=eth_exe.map";
COMPILER = "arm-none-eabi-gcc";
CPPCOMPILER = "arm-none-eabi-g++";
ASSEMBLER = "arm-none-eabi-as";
LINKER = "arm-none-eabi-ld";
COPIER = "arm-none-eabi-objcopy";
SYSTEM = PYTHON;
LIBRARY = serial;
LIBRARY = lwip;
};
SYSTEM_CALL = TRUE;
MEMMAP = TRUE {
COMPILER = gcc;
LINKER = gnu_ld { SCRIPT = "script.ld"; };
ASSEMBLER = gnu_as;
MEMORY_PROTECTION = FALSE;
};
};

APPMODE std {};

TASK sample_init {
PRIORITY = 1;
AUTOSTART = TRUE { APPMODE = std; };
ACTIVATION = 1;
SCHEDULE = FULL;
};

TASK monitor {
PRIORITY = 1;
AUTOSTART = FALSE;
ACTIVATION = 1;
SCHEDULE = FULL;
};

/* ethernet driver needs */
TASK gwca1_rx_tx_task {
PRIORITY = 2;
AUTOSTART = FALSE;
ACTIVATION = 1;
SCHEDULE = FULL;
};

ISR gwca1_rx_tx_int {
CATEGORY = 2;
PRIORITY = 2;
SOURCE = GWCA1_RX_TX_INT;
};

ISR gwca1_rx_ts_int {
CATEGORY = 2;
PRIORITY = 3;
SOURCE = GWCA1_RX_TS_INT;
};

ISR coma_err_int {
CATEGORY = 2;
PRIORITY = 4;
SOURCE = COMA_ERR_INT;
};

ISR gwca1_err_int {
CATEGORY = 2;
PRIORITY = 5;
SOURCE = GWCA1_ERR_INT;
};

ISR etha0_err_int {
CATEGORY = 2;
PRIORITY = 6;
SOURCE = ETHA0_ERR_INT;
};
};
58 changes: 58 additions & 0 deletions examples/cortex-a-r/armv8/spider/ethernet/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include "tpl_os.h"
#include "utils.h"
#include "spider_serial.h"
#include "string.h"
#include "lwip/netif.h"
#include "lwip/ip4_addr.h"
#include "lwip/timeouts.h"
#include "ethif.h"

#define APP_Task_sample_init_START_SEC_CODE
#include "tpl_memmap.h"

ip4_addr_t ip4_addr, net_mask, gateway;
struct netif ethif_netif;

// Is this the right section for the main function??
FUNC(int, OS_APPL_CODE) main(void)
{
StartOS(OSDEFAULTAPPMODE);
return 0;
}

TASK(sample_init) {
Serial_Init();

rswitch_enable_clock_and_reset();
port_init();

lwip_init();

IP4_ADDR(&ip4_addr, 192, 168, 1, 2);
IP4_ADDR(&net_mask, 255, 255, 255, 0);
IP4_ADDR(&gateway, 0, 0, 0, 0);

netif_add(&ethif_netif, &ip4_addr, &net_mask, &gateway, NULL,
ethif_init, netif_input);

netif_set_up(&ethif_netif);

ActivateTask(monitor);

TerminateTask();
}

#define APP_Task_sample_init_STOP_SEC_CODE
#include "tpl_memmap.h"

#define APP_Task_sample_init_START_SEC_CODE
#include "tpl_memmap.h"

TASK(monitor) {
while (1) {
sys_check_timeouts();
}
}

#define APP_Task_sample_init_STOP_SEC_CODE
#include "tpl_memmap.h"
15 changes: 15 additions & 0 deletions examples/cortex-a-r/armv8/spider/ethernet_basic/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

#stop on errors
set -e

if [[ ! -d "_build" ]]
then
mkdir _build
fi

echo "*** Run Goil ***"
goil --target=cortex-a-r/armv8/spider --templates=../../../../../goil/templates/ eth.oil

echo "*** Run Make ***"
./make.py
93 changes: 93 additions & 0 deletions examples/cortex-a-r/armv8/spider/ethernet_basic/eth.oil
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
OIL_VERSION = "4.0";

IMPLEMENTATION trampoline {
TASK {
UINT32 STACKSIZE = 2048 ;
} ;

ISR {
UINT32 STACKSIZE = 2048 ;
} ;
};

CPU eth {
OS config {
STATUS = EXTENDED;

BUILD = TRUE {
TRAMPOLINE_BASE_PATH = "../../../../..";
APP_SRC = "main.c";
APP_NAME = "eth_exe.elf";
CFLAGS = "-O0 -g -DHSCIF_1843200BPS";
LDFLAGS = "-Map=eth_exe.map";
COMPILER = "arm-none-eabi-gcc";
CPPCOMPILER = "arm-none-eabi-g++";
ASSEMBLER = "arm-none-eabi-as";
LINKER = "arm-none-eabi-ld";
COPIER = "arm-none-eabi-objcopy";
SYSTEM = PYTHON;
LIBRARY = serial;
LIBRARY = ethernet;
};
SYSTEM_CALL = TRUE;
MEMMAP = TRUE {
COMPILER = gcc;
LINKER = gnu_ld { SCRIPT = "script.ld"; };
ASSEMBLER = gnu_as;
MEMORY_PROTECTION = FALSE;
};
};

APPMODE std {};

TASK sample_init {
PRIORITY = 1;
AUTOSTART = TRUE { APPMODE = std; };
ACTIVATION = 1;
SCHEDULE = FULL;
};

TASK echo {
PRIORITY = 1;
AUTOSTART = FALSE;
ACTIVATION = 1;
SCHEDULE = FULL;
};

TASK gwca1_rx_tx_task {
PRIORITY = 2;
AUTOSTART = FALSE;
ACTIVATION = 1;
SCHEDULE = FULL;
};

ISR gwca1_rx_tx_int {
CATEGORY = 1;
PRIORITY = 3;
SOURCE = GWCA1_RX_TX_INT;
};

ISR gwca1_rx_ts_int {
CATEGORY = 1;
PRIORITY = 4;
SOURCE = GWCA1_RX_TS_INT;
};

ISR coma_err_int {
CATEGORY = 1;
PRIORITY = 5;
SOURCE = COMA_ERR_INT;
};

ISR gwca1_err_int {
CATEGORY = 1;
PRIORITY = 6;
SOURCE = GWCA1_ERR_INT;
};

ISR etha0_err_int {
CATEGORY = 1;
PRIORITY = 7;
SOURCE = ETHA0_ERR_INT;
};
};
Loading