Skip to content

Commit

Permalink
Merge pull request #150 from TrampolineRTOS/fsylvestre/add_cr52_seria…
Browse files Browse the repository at this point in the history
…l_ethernet_drivers

Add cr52 serial ethernet drivers
  • Loading branch information
RICCIARDI-Adrien authored Nov 16, 2023
2 parents ad2217e + 4d0063f commit 7952a97
Show file tree
Hide file tree
Showing 41 changed files with 4,879 additions and 1 deletion.
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

0 comments on commit 7952a97

Please sign in to comment.