-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ba72f1
commit da75f97
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
#stop on errors | ||
set -e | ||
|
||
if [[ ! -d "_build" ]] | ||
then | ||
mkdir _build | ||
fi | ||
|
||
echo "*** Run Goil ***" | ||
goil --target=rh850/g4mh --templates=../../../goil/templates/ serial.oil | ||
cd _build | ||
echo "*** Run CMake ***" | ||
cmake -G "Unix Makefiles" -D CMAKE_TOOLCHAIN_FILE=../serial/compiler.cmake .. | ||
echo "*** Run Make ***" | ||
make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "tpl_os.h" | ||
|
||
#include "spider_serial.h" | ||
#include "printf.h" | ||
|
||
FUNC(int, OS_APPL_CODE) main(void) | ||
{ | ||
|
||
StartOS(OSDEFAULTAPPMODE); | ||
return 0; | ||
} | ||
|
||
volatile uint32 tmp = 0; | ||
|
||
TASK(serial_rx) | ||
{ | ||
uint8 uart_rx; | ||
|
||
Serial_Init(); | ||
|
||
debug_printf("serial_rx task started\r\n"); | ||
|
||
while(1) | ||
{ | ||
if (Serial_Rx(&uart_rx)) | ||
{ | ||
/* If received a char, send back the next one */ | ||
Serial_Tx(uart_rx+1); | ||
} | ||
} | ||
} | ||
|
||
TASK(serial_tx) | ||
{ | ||
/* Send next alphabet letter each time*/ | ||
static uint8 uart_char=0; | ||
uart_char = (uart_char+1) % 26; | ||
Serial_Tx('a' + uart_char); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
OIL_VERSION = "4.2"; | ||
|
||
IMPLEMENTATION trampoline { | ||
TASK { | ||
UINT32 STACKSIZE = 2048 ; | ||
} ; | ||
|
||
ISR { | ||
UINT32 STACKSIZE = 2048 ; | ||
} ; | ||
}; | ||
|
||
CPU serial { | ||
OS config { | ||
STATUS = EXTENDED; | ||
|
||
BUILD = TRUE { | ||
TRAMPOLINE_BASE_PATH = "../../../"; | ||
APP_SRC = "serial.c"; | ||
APP_NAME = "serial_exe"; | ||
LDFLAGS="-debug -nocompress -NOOPtimize -memory=high -nologo -SHow=ALL"; | ||
CFLAGS="-DHSCIF_1843200BPS -Xcpu=g4mh -g -g_line -Xfxu=off -Xasm_path=."; | ||
LINKER = "rlink"; | ||
SYSTEM = CMAKE; | ||
|
||
LIBRARY = serial; | ||
}; | ||
SYSTEM_CALL = TRUE; | ||
}; | ||
|
||
APPMODE std {}; | ||
|
||
TASK serial_rx { | ||
PRIORITY = 1; | ||
AUTOSTART = TRUE { APPMODE = std; }; | ||
ACTIVATION = 1; | ||
SCHEDULE = FULL; | ||
}; | ||
|
||
TASK serial_tx { | ||
PRIORITY = 2; | ||
AUTOSTART = FALSE; | ||
ACTIVATION = 1; | ||
SCHEDULE = FULL; | ||
}; | ||
|
||
ALARM serial_serial { | ||
COUNTER = SystemCounter; | ||
ACTION = ACTIVATETASK { | ||
TASK = serial_tx; | ||
}; | ||
AUTOSTART = TRUE { | ||
APPMODE = std; | ||
ALARMTIME = 100; | ||
CYCLETIME = 100; | ||
}; | ||
}; | ||
}; | ||
|