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

Added initial Renesas Cortex-R52 support. #148

Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
274beb9
machines: cortex-a-r:
fsylvestre Apr 25, 2023
088b86e
machines: cortex-a-r: Add helpers to access cp15 registers.
fsylvestre Apr 25, 2023
1957a26
goil: move inclusion of 'tpl_vector_table.s' in board specific config
fsylvestre Apr 25, 2023
e261db2
add support for ARMV8-CortexR52-Spider platform
fsylvestre Apr 25, 2023
4c85b24
examples: cortex-a-r: add 'one_task' example for Spider platform
fsylvestre Apr 25, 2023
11783b7
examples: cortex-a-r: add 'blink' example for Spider platform
fsylvestre Apr 25, 2023
00e980e
machines: cortex-a-r: FIXUP: use correct vector for reset for Spider …
fsylvestre Apr 26, 2023
0ba06c4
CR52: Update base address to 0x00000000
fsylvestre May 5, 2023
7b68956
CR52: Update interrupt vectors for Spider boards (only ARM timer and …
fsylvestre May 5, 2023
2df9f76
CR52: add 'tpl_time_counter' support
fsylvestre May 5, 2023
92002eb
CR52: add interrupts support
fsylvestre May 5, 2023
519092f
FIX tpl_isr_stat_table reference in 'tpl_os_interrupt_kernel.h' to ma…
fsylvestre May 5, 2023
f7141e1
CR52: add ICCOM example
fsylvestre May 5, 2023
4b94f3e
FIX: Add clear flag for ARM_TIMER and update IRQ and systick init order
fsylvestre May 15, 2023
74e9a64
FIX: Correctly update ARM Timer compare value for next interrupt
fsylvestre May 16, 2023
23c924b
machines: cortex-a-r: Spider: Fix Timer interrupt period
fsylvestre Jun 21, 2023
26c4e06
Spider: Add HW support for LED blinking example
fsylvestre May 23, 2023
d4188ef
Spider: fix tpl_time_counter implementation
fsylvestre Jul 4, 2023
52dac8e
linker: fix RAM placement
valeriosetti Jul 12, 2023
b181419
spider: fix enabling/disabling interrupts function
fsylvestre Sep 21, 2023
26d67bd
core: fix 'tpl_task_events_table' section description
fsylvestre Sep 21, 2023
50995db
machines: cortex-a-r: spider: Added the registers definition from Ren…
RICCIARDI-Adrien Sep 20, 2023
c57cc1f
machines: spider: Added the CAN 2.0 driver.
RICCIARDI-Adrien Sep 20, 2023
c74e542
examples: spider: Added a CAN demo application that waits for a frame…
RICCIARDI-Adrien Sep 21, 2023
1cabf52
machines: spider: Adapted the CAN driver to the CAN stack changes rel…
RICCIARDI-Adrien Sep 26, 2023
fb3fc66
examples: spider: Adapted the CAN demo to the CAN stack changes relat…
RICCIARDI-Adrien Sep 26, 2023
fe29ed4
machines: spider: Changed the CAN module clock from 20MHz to 80MHz in…
RICCIARDI-Adrien Sep 26, 2023
a73b524
machines: spider: Adapted the CAN driver to the CAN stack changes.
RICCIARDI-Adrien Oct 3, 2023
037c9eb
examples: spider: Adapted the CAN demo example to the CAN stack changes.
RICCIARDI-Adrien Oct 3, 2023
fd0bbfa
machines: spider: Fixed a data abort exception in the CAN driver trig…
RICCIARDI-Adrien Oct 3, 2023
acd284b
machines: spider: Improved the CAN driver transmission function relia…
RICCIARDI-Adrien Oct 5, 2023
bc8492a
machines: spider: Added CAN-FD support (without BRS) to the CAN driver.
RICCIARDI-Adrien Oct 6, 2023
b334ebc
examples: spider: Added CAN-FD support to the CAN demo application.
RICCIARDI-Adrien Oct 6, 2023
35ff7ae
machines: spider: Added extended CAN ID support to the CAN driver.
RICCIARDI-Adrien Oct 9, 2023
655ca7a
examples: spider: Added extended CAN ID support to the CAN demo.
RICCIARDI-Adrien Oct 9, 2023
e15e63e
machines: spider: Used reception FIFO instead of a single message buf…
RICCIARDI-Adrien Oct 12, 2023
4806813
machines: spider: Used the CAN module FIFO for frames transmission in…
RICCIARDI-Adrien Oct 13, 2023
2b838bb
machines: spider: can: Added the CAN controller 1 support to the CAN …
RICCIARDI-Adrien Nov 7, 2023
238b06a
ci: Added Renesas Spider Cortex-R52 examples build.
RICCIARDI-Adrien Nov 9, 2023
3bdaced
readme: Added the Spider CR52 platform.
RICCIARDI-Adrien Nov 9, 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
31 changes: 31 additions & 0 deletions .github/workflows/build-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,37 @@ jobs:
run: ./make.py
working-directory: examples/cortex-a-r/armv7/bcm2836/rpi2/${{ matrix.example_name }}

cortex-a-r-spider-examples:
name: Build Renesas Spider Cortex-R52 examples
runs-on: ubuntu-22.04
needs: goil
env:
ARM_TOOLCHAIN_NAME: arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi
strategy:
matrix:
example_name: [blink, can_demo, iccom, one_task]
steps:
# A toolchain newer than the one included in Ubuntu 22.04 is needed
- name: Install ARM toolchain
run: |
wget https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/${{ env.ARM_TOOLCHAIN_NAME }}.tar.xz
sudo tar -xf ${{ env.ARM_TOOLCHAIN_NAME }}.tar.xz -C /opt
- name: Retrieve sources and Goil binary
uses: actions/cache/restore@v3
with:
path: ${{ github.workspace }}
key: ${{ env.CACHE_KEY }}
- name: Generate the code
run: |
echo "$(realpath /opt/${{ env.ARM_TOOLCHAIN_NAME }}/bin)" >> $GITHUB_PATH
${{ env.GOIL }} --target=cortex-a-r/armv8/spider --templates=../../../../../goil/templates/ ${{ matrix.example_name }}.oil
working-directory: examples/cortex-a-r/armv8/spider/${{ matrix.example_name }}
- name: Build the code
run: |
echo "$(realpath /opt/${{ env.ARM_TOOLCHAIN_NAME }}/bin)" >> $GITHUB_PATH
./make.py
working-directory: examples/cortex-a-r/armv8/spider/${{ matrix.example_name }}

avr-arduino-uno-examples:
name: Build AVR Arduino Uno examples
runs-on: ubuntu-22.04
Expand Down
5 changes: 5 additions & 0 deletions examples/cortex-a-r/armv8/spider/blink/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build/
blink/
*.map
*.py
blink_exe*
93 changes: 93 additions & 0 deletions examples/cortex-a-r/armv8/spider/blink/blink.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#include "tpl_os.h"

#define APP_Task_blink_START_SEC_CODE
#include "tpl_memmap.h"
#include "stdint.h"
#include "stdbool.h"
uint8_t *led8 = (uint8_t*)(0xe6050180 + 0x14);

#define GPIO0_BASE_ADDR 0xe6050180
#define IOINTSEL 0x00 /* General IO/Interrupt Switching Register */
#define INOUTSEL 0x04 /* General Input/Output Switching Register */
#define OUTDT 0x08 /* General Output Register */
#define INDT 0x0c /* General Input Register */
#define INTDT 0x10 /* Interrupt Display Register */
#define INTCLR 0x14 /* Interrupt Clear Register */
#define INTMSK 0x18 /* Interrupt Mask Register */
#define MSKCLR 0x1c /* Interrupt Mask Clear Register */
#define POSNEG 0x20 /* Positive/Negative Logic Select Register */
#define EDGLEVEL 0x24 /* Edge/level Select Register */
#define FILONOFF 0x28 /* Chattering Prevention On/Off Register */
#define OUTDTSEL 0x40 /* Output Data Select Register */
#define BOTHEDGE 0x4c /* One Edge/Both Edge Select Register */
#define INEN 0x50 /* General Input Enable Register */

#define GPIO_PIN 14

void gpio_modify_bit(uint32_t *addr, int bit, bool val) {
uint32_t tmp = *addr;
if(val) {
tmp |= (1<<bit);
} else {
tmp &= ~(1<<bit);
}
*addr = tmp;
}

void init_gpio(void){
uint32_t *addr;
/** GPIO **/
// *POSNEG = 0; // Positive logic
addr = (uint32_t*)(GPIO0_BASE_ADDR+POSNEG);
gpio_modify_bit(addr, GPIO_PIN, false);
// *INEN = 0; // General input disable
addr = (uint32_t*)(GPIO0_BASE_ADDR+INEN);
gpio_modify_bit(addr, GPIO_PIN, false);
// *IOINTSEL = 0; // General I/O mode
addr = (uint32_t*)(GPIO0_BASE_ADDR+IOINTSEL);
gpio_modify_bit(addr, GPIO_PIN, false);
// *INOUTSEL = 1; // General Output mode
addr = (uint32_t*)(GPIO0_BASE_ADDR+INOUTSEL);
gpio_modify_bit(addr, GPIO_PIN, true);
// *OUTDT = led_status; // output
addr = (uint32_t*)(GPIO0_BASE_ADDR+OUTDTSEL);
gpio_modify_bit(addr, GPIO_PIN, false);

}

void led(uint8_t status) {
uint32_t *addr;
// *OUTDT = led_status; // output
addr = (uint32_t*)(GPIO0_BASE_ADDR+OUTDT);
gpio_modify_bit(addr, GPIO_PIN, status);
}

volatile uint32_t temp = 0;
FUNC(int, OS_APPL_CODE) main(void)
{
init_gpio();
// for( int i = 0; i< 10; ++i) {
// led(0);
// for (int n=0; n<0xffffff; ++n) temp = n;
// led(1);
// for (int n=0; n<0xffffff; ++n) temp = n;
// }
StartOS(OSDEFAULTAPPMODE);
return 0;
}

volatile uint32_t tmp = 0;
TASK(my_only_task)
{
TerminateTask();
}

TASK(blink)
{
static int8_t led_status = 0;
led(led_status);
led_status = 1 - led_status;
TerminateTask();
}
#define APP_Task_blink_STOP_SEC_CODE
#include "tpl_memmap.h"
69 changes: 69 additions & 0 deletions examples/cortex-a-r/armv8/spider/blink/blink.oil
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
OIL_VERSION = "4.2";

IMPLEMENTATION trampoline {

/* This fix the default STACKSIZE of tasks */
TASK {
UINT32 STACKSIZE = 1000 ;
} ;

/* This fix the default STACKSIZE of ISRs */
ISR {
UINT32 STACKSIZE = 1000 ;
} ;
};

CPU blink {
OS config {
STATUS = EXTENDED;

BUILD = TRUE {
TRAMPOLINE_BASE_PATH = "../../../../..";
APP_SRC = "blink.c";
APP_NAME = "blink_exe.elf";
CFLAGS = "-O0";
LDFLAGS = "-Map=blink.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;
};
SYSTEM_CALL = TRUE;
MEMMAP = TRUE {
COMPILER = gcc;
LINKER = gnu_ld { SCRIPT = "script.ld"; };
ASSEMBLER = gnu_as;
MEMORY_PROTECTION = FALSE;
};
};

APPMODE std {};

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

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

ALARM blink_blink {
COUNTER = SystemCounter;
ACTION = ACTIVATETASK {
TASK = blink;
};
AUTOSTART = TRUE {
APPMODE = std;
ALARMTIME = 100;
CYCLETIME = 100;
};
};
};
10 changes: 10 additions & 0 deletions examples/cortex-a-r/armv8/spider/blink/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

#stop on errors
set -e

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

echo "*** Run Make ***"
./make.py
4 changes: 4 additions & 0 deletions examples/cortex-a-r/armv8/spider/can_demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
can_demo/
can_demo_exe*
*.map
*.py
40 changes: 40 additions & 0 deletions examples/cortex-a-r/armv8/spider/can_demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Trampoline CAN demo example

This example allows to test the Trampoline CAN stack on the Spider board.

## Hardware setup

Connect a CAN probe to the Spider board CAN0 SUB-D 9 connector (CN13A).

For the test, we used a Kvaser USBcan Pro 2xHS v2 connected to a Windows 10 PC running the Kvaser CanKing software.
As the Kvaser probe does not provide CAN bus terminating resistors, we made a little adaptation PCB with terminating resistors.
For that, we cut in half two DB-9 cables and kept the two female parts.
On the PCB, we wired the DB-9 pins 7 together (the CAN high signal), the DB-9 pins 2 together (the CAN low signal) and the DB-9 pins 3 together (the CAN ground).
Between the DB-9 pin 7 and pin 3 we soldered a 60 ohms resistors, we also added a second 60 ohms resistors between the DB-9 pin 2 and pin 3.

## Software setup

The Kvaser CanKing CAN bus configuration is as follow :
* Bus speed : 125 Kbit/s.
* Sample point : 75% (Tseg1 = 11, TSeg2 = 4).
* SWJ (Synchronization Jump Width) : 4.

No configuration is needed on the CAN demo application side.

## Building

On Linux :
```
cd examples/cortex-a-r/armv8/spider/can_demo
goil --target=cortex-a-r/armv8/spider --templates=../../../../../goil/templates/ can_demo.oil
./make.py
```

## Running

Before starting the CAN demo application, connect the hardware setup and configure the Kvaser CanKing application as described in the above paragraphs.
Then, click the CanKing `Go On Bus` button.
Now, you can run the CAN demo application.

The CAN demo application starts by sending a CAN frame with the CAN ID `0x123` and the string payload `Ready!`.
After that, it waits for a CAN frame to be received. When a frame is received, it increments the CAN ID and all the payload bytes, then it sends the frame back.
Loading
Loading