Skip to content

Commit

Permalink
Merge pull request #4 from At-EC/main
Browse files Browse the repository at this point in the history
At-RTOS release v1.2.0
  • Loading branch information
At-EC authored Feb 25, 2024
2 parents 049baa4 + 9f0c4b8 commit 65ab19f
Show file tree
Hide file tree
Showing 45 changed files with 2,235 additions and 2,291 deletions.
43 changes: 43 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Online References website is: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# The recommendation version of clang-format is up to 17.

---
Language: Cpp
BasedOnStyle: LLVM

AlignConsecutiveMacros: AcrossComments
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AttributeMacros:
- __aligned
- __packed
- __syscall
BitFieldColonSpacing: Both
BreakBeforeBraces: Linux
ColumnLimit: 140
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4

IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^".*\.h"$'
Priority: 0
- Regex: '^<(stdlib|string|stdbool|stdio|type|basic)\.h>$'
Priority: 1
- Regex: '^\<atos/.*\.h\>$'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 4
InsertBraces: true
SpaceBeforeParens: ControlStatementsExceptControlMacros
SortIncludes: Never
UseTab: Never
WhitespaceSensitiveMacros:
- PRINTF

6 changes: 2 additions & 4 deletions .github/remote_build/native_gcc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ static os_thread_id_t g_sample_thread_id;
**/
static void sample_entry_thread(void)
{
while(1)
{
while(1) {
/* Put the current thread into sleep state */
AtOS.thread_sleep(1000);
}
Expand All @@ -35,8 +34,7 @@ int main(void)
{
g_sample_thread_id = AtOS.thread_init(sample_thread, sample_entry_thread);

if (AtOS.id_isInvalid(g_sample_thread_id))
{
if (AtOS.id_isInvalid(g_sample_thread_id)) {
/* return _PC_CMPT_FAILED; */
}

Expand Down
154 changes: 77 additions & 77 deletions .github/script/BuildScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,83 +93,83 @@ function BuildScript
New-Item -Path $TargetFile -ItemType File
$FileContent | Out-File -FilePath $TargetFile -Force -Encoding utf8
}
$ReadContent = [string](Get-Content -Path $TargetFile -Raw)
$MatchNumber = '[0-9]+'

$MatchMajorLine = '#define ATOS_VERSION_MAJOR_NUMBER \([0-9]+u\)'
$MajorLine = ($ReadContent | Select-String -Pattern $MatchMajorLine -AllMatches).Matches.Value
$Major = ($MajorLine | Select-String -Pattern $MatchNumber -AllMatches).Matches.Value
$Major = [int]$Major

$MatchMinorLine = '#define ATOS_VERSION_MINOR_NUMBER \([0-9]+u\)'
$MinorLine = ($ReadContent | Select-String -Pattern $MatchMinorLine -AllMatches).Matches.Value
$Minor = ($MinorLine | Select-String -Pattern $MatchNumber -AllMatches).Matches.Value
$Minor = [int]$Minor
$MatchPatchLine = '#define ATOS_VERSION_PATCH_NUMBER \([0-9]+u\)'
$PatchLine = ($ReadContent | Select-String -Pattern $MatchPatchLine -AllMatches).Matches.Value
$Patch = ($PatchLine | Select-String -Pattern $MatchNumber -AllMatches).Matches.Value
$Patch = [int]$Patch

$MatchCommitId = '[0123456789abcdef]{40}'
$ReadCommitId = ($ReadContent | Select-String -Pattern $MatchCommitId -AllMatches).Matches.Value

$timestamp = Get-Date -Format "yyyy-MM-dd,HH:mm"
$ReadContent = [string](Get-Content -Path $TargetFile -Raw)
$MatchNumber = '[0-9]+'

$MatchMajorLine = '#define ATOS_VERSION_MAJOR_NUMBER \([0-9]+u\)'
$MajorLine = ($ReadContent | Select-String -Pattern $MatchMajorLine -AllMatches).Matches.Value
$Major = ($MajorLine | Select-String -Pattern $MatchNumber -AllMatches).Matches.Value
$Major = [int]$Major

$MatchMinorLine = '#define ATOS_VERSION_MINOR_NUMBER \([0-9]+u\)'
$MinorLine = ($ReadContent | Select-String -Pattern $MatchMinorLine -AllMatches).Matches.Value
$Minor = ($MinorLine | Select-String -Pattern $MatchNumber -AllMatches).Matches.Value
$Minor = [int]$Minor
$MatchPatchLine = '#define ATOS_VERSION_PATCH_NUMBER \([0-9]+u\)'
$PatchLine = ($ReadContent | Select-String -Pattern $MatchPatchLine -AllMatches).Matches.Value
$Patch = ($PatchLine | Select-String -Pattern $MatchNumber -AllMatches).Matches.Value
$Patch = [int]$Patch

$MatchCommitId = '[0123456789abcdef]{40}'
$ReadCommitId = ($ReadContent | Select-String -Pattern $MatchCommitId -AllMatches).Matches.Value

$timestamp = Get-Date -Format "yyyy-MM-dd,HH:mm"
$CommitHeadID = invoke-expression -command "git rev-parse HEAD"

if ($ReadCommitId -notmatch $CommitHeadID)
{
if ($Environment -match 'Local')
{
$Patch++
}
elseif ($Environment -match 'Remote')
{
if ($TargetVersion -match 'Minor')
{
$Minor++
$Patch = [int]0
}
elseif ($TargetVersion -match 'Major')
{
$Major++
$Minor = [int]0
$Patch = [int]0
}
}
}
$Major = [string]$Major
$Minor = [string]$Minor
$Patch = [string]$Patch
$OutContent = $ReadContent -replace '\d{4}-\d{2}-\d{2},\d{2}:\d{2}', $timestamp
$OutContent = $OutContent -replace '[0123456789abcdef]{40}', $CommitHeadID
$MatchLine = $MajorLine -replace "[0-9]", $Major
$OutContent = $OutContent -replace $MatchMajorLine, $MatchLine
$MatchLine = $MinorLine -replace "[0-9]", $Minor
$OutContent = $OutContent -replace $MatchMinorLine, $MatchLine
$MatchLine = $PatchLine -replace "[0-9]", $Patch
$OutContent = $OutContent -replace $MatchPatchLine, $MatchLine
$OutContent | Out-File -FilePath $TargetFile -Force -Encoding utf8 -NoNewline
$FirmwareRelease = $Major + "." + $Minor + "." + $Patch
Write-Host $FirmwareRelease
$packageContent = Get-Content -Raw -Path $PackageFile | ConvertFrom-Json
$packageContent.version = $FirmwareRelease
$packageContent.timestamp = $timestamp
$packageContent.commit_id = $ReadCommitId
$packageString = $packageContent | ConvertTo-Json -Depth 10
$packageString | Set-Content -Path $PackageFile
if ($ReadCommitId -notmatch $CommitHeadID)
{
if ($Environment -match 'Local')
{
$Patch++
}
elseif ($Environment -match 'Remote')
{
if ($TargetVersion -match 'Minor')
{
$Minor++
$Patch = [int]0
}
elseif ($TargetVersion -match 'Major')
{
$Major++
$Minor = [int]0
$Patch = [int]0
}
}
}
$Major = [string]$Major
$Minor = [string]$Minor
$Patch = [string]$Patch
$OutContent = $ReadContent -replace '\d{4}-\d{2}-\d{2},\d{2}:\d{2}', $timestamp
$OutContent = $OutContent -replace '[0123456789abcdef]{40}', $CommitHeadID
$MatchLine = $MajorLine -replace "[0-9]", $Major
$OutContent = $OutContent -replace $MatchMajorLine, $MatchLine
$MatchLine = $MinorLine -replace "[0-9]", $Minor
$OutContent = $OutContent -replace $MatchMinorLine, $MatchLine
$MatchLine = $PatchLine -replace "[0-9]", $Patch
$OutContent = $OutContent -replace $MatchPatchLine, $MatchLine
$OutContent | Out-File -FilePath $TargetFile -Force -Encoding utf8 -NoNewline
$FirmwareRelease = $Major + "." + $Minor + "." + $Patch
Write-Host $FirmwareRelease
$packageContent = Get-Content -Raw -Path $PackageFile | ConvertFrom-Json
$packageContent.version = $FirmwareRelease
$packageContent.timestamp = $timestamp
$packageContent.commit_id = $ReadCommitId
$packageString = $packageContent | ConvertTo-Json -Depth 10
$packageString | Set-Content -Path $PackageFile
}
24 changes: 24 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: clang-format check
on: [push, pull_request]
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
strategy:
matrix:
path:
- check: './include'
exclude: '' # Nothing to exclude
- check: './kernal'
exclude: '' # Nothing to exclude
- check: './clock'
exclude: '' # Nothing to exclude
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check for C programs.
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '17'
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['exclude'] }}
fallback-style: 'LLVM'
Loading

0 comments on commit 65ab19f

Please sign in to comment.