Skip to content

Commit

Permalink
add Net releated modules
Browse files Browse the repository at this point in the history
  • Loading branch information
parai committed Nov 27, 2021
1 parent b59fb16 commit 41bed46
Show file tree
Hide file tree
Showing 77 changed files with 4,995 additions and 15 deletions.
35 changes: 35 additions & 0 deletions Console.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@echo off

set ASPATH=%~dp0
set astmp=%ASPATH%
set ASDISK=%astmp:~1,2%
set MSYS2=C:\msys64

%ASDISK%
cd %ASPATH%

REM base env PATH
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0

set PATH=C:\Anaconda3;C:\Anaconda3\Scripts;%MSYS2%\mingw64\bin;%MSYS2%\usr\bin;%MSYS2%\mingw32\bin;%PATH%
set PATH=%PATH%;%ASPATH%\download\gcc-arm-none-eabi-5_4-2016q3-20160926-win32\bin

set ConEmu=%ASPATH%\download\ConEmu\ConEmu64.exe

if EXIST %ConEmu% goto prepareEnv
cd %ASPATH%\download
mkdir ConEmu
cd ConEmu
wget https://github.com/Maximus5/ConEmu/releases/download/v21.04.22/ConEmuPack.210422.7z
"C:\Program Files\7-Zip\7z.exe" x ConEmuPack.210422.7z
cd %ASPATH%

:prepareEnv
set MSYS=winsymlinks:nativestrict

start %ConEmu% -title sim-app-boot-tools ^
-runlist -new_console:d:"%ASPATH%":t:sim ^
^|^|^| -new_console:d:"%ASPATH%":t:app ^
^|^|^| -new_console:d:"%ASPATH%":t:boot ^
^|^|^| -new_console:d:"%ASPATH%/tools":t:tools

18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SSAS - Simple Smart Automotive Software
# AS - Automotive Software

This project is not open source, all of the BSWs are developed by me alone according to AUTOSAR 4.2.
This project is not open source, all of the BSWs are developed by me alone according to AUTOSAR 4.4.

## BSWs of AUTOSAR

Expand All @@ -12,14 +12,22 @@ This project now provide below BSWs:
CanTp
Dem
Dcm

OsekNm
CanNm


Fls
Fee
Eep
Ea
MemIf (zero cost only)
NvM

TcpIP (socket based, LWIP is supported)
SoAd
DoIP
SOMEIP

## Tools & Libraries

This project now provide below tools & libraries:
Expand All @@ -40,6 +48,8 @@ This project now provide below tools & libraries:

**AsOne**: PyQT5 based GUI tool for Com/Dcm

**DoIPClient** : DoIP client library to access DoIP server


## prebuilt demo applications and its tools

Expand Down
63 changes: 60 additions & 3 deletions app/app/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ CWD = GetCurrentDir()

generate(Glob('config/*.json'))
generate(Glob('config/Com/*.json'))
generate(Glob('config/Net/*.json'))

objsApp = Glob('*.c') + Glob('src/*.c')

LL_DL = os.getenv('LL_DL')


class ApplicationApp(Application):
def config(self):
Expand All @@ -19,7 +22,8 @@ class ApplicationApp(Application):
for libName, source in self.libsForApp.items():
self.LIBS.append(libName)
self.RegisterConfig(libName, source)
self.Append(CPPDEFINES=['USE_%s' % (libName.split(':')[0].upper())])
self.Append(CPPDEFINES=['USE_%s' %
(libName.split(':')[0].upper())])
self.source = objsApp


Expand All @@ -28,19 +32,23 @@ libsCommon = {'Dcm': Glob('config/Dcm/Dcm_Cfg.c'),
'Fls': Glob('config/Fls_Cfg.c'),
'Fee': Glob('config/GEN/Fee_Cfg.c'),
'NvM': Glob('config/GEN/NvM_Cfg.c'),
}
'Eep': Glob('config/Eep_Cfg.c'),
'Ea': Glob('config/GEN/Ea_Cfg.c'),
}

libsForCanApp = {'CanTp': Glob('../bootloader/config/CanTp_Cfg.c'),
'OsekNm': Glob('config/OsekNm_Cfg.c'),
'CanNm': Glob('config/CanNm_Cfg.c'),
'Com': Glob('config/Com/GEN/Com_Cfg.c'),
}
}
libsForCanApp.update(libsCommon)


@register_application
class ApplicationCanApp(ApplicationApp):
def platform_config(self):
if LL_DL != None:
self.Append(CPPDEFINES=['CANTP_LL_DL=%s' % (LL_DL)])
self.Append(CPPDEFINES=['USE_STD_DEBUG'])
self.LIBS.append('Simulator')

Expand All @@ -50,6 +58,7 @@ class ApplicationCanApp(ApplicationApp):
self.Append(CPPDEFINES=['USE_CAN'])
self.platform_config()


@register_application
class ApplicationCanNm(ApplicationApp):
def platform_config(self):
Expand All @@ -62,6 +71,7 @@ class ApplicationCanNm(ApplicationApp):
self.Append(CPPDEFINES=['USE_CAN'])
self.platform_config()


@register_application
class ApplicationOsekNm(ApplicationApp):
def platform_config(self):
Expand All @@ -73,3 +83,50 @@ class ApplicationOsekNm(ApplicationApp):
super().config()
self.Append(CPPDEFINES=['USE_CAN'])
self.platform_config()


libsForNetApp = {
'SoAd': Glob('config/Net/GEN/SoAd_*.c'),
'DoIP': Glob('config/Net/GEN/DoIp_*.c'),
'Sd': Glob('config/Net/GEN/Sd_*.c'),
'SomeIp': Glob('config/Net/GEN/SomeIp_*.c'),
}
libsForNetApp.update(libsCommon)

libsForNetAppT = {
'SoAd': Glob('config/Net/GENT/SoAd_*.c'),
'Sd': Glob('config/Net/GENT/Sd_*.c'),
'SomeIp': Glob('config/Net/GENT/SomeIp_*.c'),
}


@register_application
class ApplicationNetApp(Application):
mylibs = libsForNetApp

def platform_config(self):
self.Append(CPPDEFINES=['USE_STD_DEBUG'])
self.LIBS.append('Simulator')

def config(self):
self.CPPPATH = ['$INFRAS', '%s/include' % (CWD)]
self.source = objsApp
self.LIBS = ['TcpIp', 'StdTimer']
self.Append(CPPDEFINES=['USE_TCPIP'])
self.Append(
CPPDEFINES=['DCM_DEFAULT_RXBUF_SIZE=4095', 'DCM_DEFAULT_TXBUF_SIZE=4095'])
self.platform_config()
for libName, source in self.mylibs.items():
self.LIBS.append(libName)
self.RegisterConfig(libName, source)
self.Append(CPPDEFINES=['USE_%s' %
(libName.split(':')[0].upper())])


@register_application
class ApplicationNetAppT(query_application('NetApp')):
mylibs = libsForNetAppT

def config(self):
super().config()
self.Append(CPPDEFINES=['LWIP_AS_LOCAL_IP_TEST'])
2 changes: 1 addition & 1 deletion app/app/config/Dcm/Dcm_Cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static const Dcm_ServiceType Dcm_UdsServices[] = {
#ifdef DCM_USE_SERVICE_SECURITY_ACCESS
DCM_SEC_LOCKED_MASK | DCM_SEC_LEVEL1_MASK | DCM_SEC_LEVEL2_MASK,
#endif
DCM_MISC_PHYSICAL | DCM_MISC_FUNCTIONAL | DCM_MISC_SUB_FUNCTION,
DCM_MISC_PHYSICAL | DCM_MISC_FUNCTIONAL,
},
Dcm_DspClearDTC,
NULL,
Expand Down
96 changes: 96 additions & 0 deletions app/app/config/Dem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"class": "Dem",
"DTCs": [
{
"name": "DTC0",
"number": "0x112200",
"priority": 0
},
{
"name": "DTC1",
"number": "0x112201",
"priority": 1
},
{
"name": "DTC2",
"number": "0x112202",
"priority": 2
},
{
"name": "DTC3",
"number": "0x112203",
"priority": 3
},
{
"name": "DTC4",
"number": "0x112204",
"priority": 4
}
],
"Environments": [
{
"name": "Battery",
"id": "0x1001",
"type": "uint16",
"unit": "v"
},
{
"name": "VehileSpeed",
"id": "0x1002",
"type": "uint16",
"unit": "km/h"
},
{
"name": "EngineSpeed",
"id": "0x1003",
"type": "uint16",
"unit": "r/min"
},
{
"name": "Time",
"id": "0x1004",
"type": "struct",
"data": [
{
"name": "year",
"type": "uint8"
},
{
"name": "month",
"type": "uint8"
},
{
"name": "day",
"type": "uint8"
},
{
"name": "hour",
"type": "uint8"
},
{
"name": "minute",
"type": "uint8"
},
{
"name": "second",
"type": "uint8"
}
],
"unit": "YY-MM-DD-HH"
}
],
"ExtendedDatas": [
{
"name": "FaultOccuranceCounter",
"type": "uint8"
},
{
"name": "AgingCounter",
"type": "uint8"
},
{
"name": "AgedCounter",
"type": "uint8"
}
]
}
59 changes: 59 additions & 0 deletions app/app/config/Eep_Cfg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* SSAS - Simple Smart Automotive Software
* Copyright (C) 2021 Parai Wang <parai@foxmail.com>
*
* ref: Specification of EEPROM Driver AUTOSAR CP Release 4.4.0
*/
/* ================================ [ INCLUDES ] ============================================== */
#include "Eep_Cfg.h"
#include "Eep_Priv.h"
#include "Ea.h"
/* ================================ [ MACROS ] ============================================== */
#ifndef EEP_BASE_ADDRESS
#define EEP_BASE_ADDRESS 0
#endif

#ifndef EEP_MAX_READ_FAST
#define EEP_MAX_READ_FAST 4096
#endif

#ifndef EEP_MAX_READ_NORM
#define EEP_MAX_READ_NORM 512
#endif

#ifndef EEP_MAX_WRITE_FAST
#define EEP_MAX_WRITE_FAST 4096
#endif

#ifndef EEP_MAX_WRITE_NORM
#define EEP_MAX_WRITE_NORM 512
#endif

#ifndef EEP_MAX_ERASE_FAST
#define EEP_MAX_ERASE_FAST 4096
#endif

#ifndef EEP_MAX_ERASE_NORM
#define EEP_MAX_ERASE_NORM 512
#endif
/* ================================ [ TYPES ] ============================================== */
/* ================================ [ DECLARES ] ============================================== */
/* ================================ [ DATAS ] ============================================== */
static const Eep_SectorType Eep_SectorList[] = {
{
EEP_BASE_ADDRESS,
EEP_BASE_ADDRESS + 4 * 1024,
4,
1,
1,
},
};

const Eep_ConfigType Eep_Config = {
Ea_JobEndNotification, Ea_JobErrorNotification, MEMIF_MODE_FAST,
EEP_MAX_READ_FAST, EEP_MAX_READ_NORM, EEP_MAX_WRITE_FAST,
EEP_MAX_WRITE_NORM, EEP_MAX_ERASE_FAST, EEP_MAX_ERASE_NORM,
Eep_SectorList, ARRAY_SIZE(Eep_SectorList),
};
/* ================================ [ LOCALS ] ============================================== */
/* ================================ [ FUNCTIONS ] ============================================== */
16 changes: 16 additions & 0 deletions app/app/config/Eep_Cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* SSAS - Simple Smart Automotive Software
* Copyright (C) 2021 Parai Wang <parai@foxmail.com>
*
* ref: Specification of EEPROM Driver AUTOSAR CP Release 4.4.0
*/
#ifndef _EEP_CFG_H
#define _EEP_CFG_H
/* ================================ [ INCLUDES ] ============================================== */
/* ================================ [ MACROS ] ============================================== */
/* ================================ [ TYPES ] ============================================== */
/* ================================ [ DECLARES ] ============================================== */
/* ================================ [ DATAS ] ============================================== */
/* ================================ [ LOCALS ] ============================================== */
/* ================================ [ FUNCTIONS ] ============================================== */
#endif /* _EEP_CFG_H */
Loading

0 comments on commit 41bed46

Please sign in to comment.