Skip to content

Commit

Permalink
Use ubuntu 20.04 for formatting so that this repo can use the same
Browse files Browse the repository at this point in the history
formatting as all other FreeRTOS Repos.

Add the formatting bot to this repo.

CMSIS Is not directly included in this repo, removing it from this
repo's manifest.yml file

Fix a broken link in aws-iot-example.md, remove the trailing comma from
a link, and add an exclude for a bash link

Add the link and manifest verification workflow to this repo. Bump
checkout actions to v3 to remove the deprecation warnings.

Signed-off-by: Soren Ptak <[email protected]>
  • Loading branch information
Skptak committed Nov 8, 2023
1 parent e27bc1b commit 3db02ff
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 152 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: ${{ github.workspace }}
submodules: 'recursive'
- name: Install python 3
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
architecture: x64
env:
Expand Down
50 changes: 28 additions & 22 deletions .github/workflows/ci.yml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,45 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone This Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run spellings check
uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
with:
path: ./

formatting:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Check formatting
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main

link-verifier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Uncrustify
run: sudo apt-get install uncrustify
- name: Run Uncrustify
run: |
uncrustify --version
find Projects Config -iname "*.[hc]" -exec uncrustify --check -c Tools/uncrustify.cfg {} +
- name: Check For Trailing Whitespace
run: |
set +e
grep --exclude="README.md" --exclude-dir=Bsp --exclude-dir=Docs --exclude-dir=Middleware -rnI -e "[[:blank:]]$" .
if [ "$?" = "0" ]; then
echo "Files have trailing whitespace."
exit 1
else
exit 0
fi
- uses: actions/checkout@v3
- name: Check Links
uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main
with:
exclude-urls: 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-\`uname'

verify-manifest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Run manifest verifier
uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main
with:
fail-on-incorrect-version: true

git-secrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Checkout awslabs/git-secrets
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: awslabs/git-secrets
ref: master
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Format Pull Request Files

on:
issue_comment:
types: [created]

env:
bashPass: \033[32;1mPASSED -
bashInfo: \033[33;1mINFO -
bashFail: \033[31;1mFAILED -
bashEnd: \033[0m

jobs:
Formatting:
name: Run Formatting Check
if: ${{ github.event.issue.pull_request &&
( ( github.event.comment.body == '/bot run uncrustify' ) ||
( github.event.comment.body == '/bot run formatting' ) ) }}
runs-on: ubuntu-20.04
steps:
- name: Apply Formatting Fix
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main
id: check-formatting
180 changes: 100 additions & 80 deletions Bsp/common/bsp_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,114 +11,134 @@

extern ARM_DRIVER_USART Driver_USART0;

void bsp_serial_init(void)
void bsp_serial_init( void )
{
Driver_USART0.Initialize(NULL);
Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS, DEFAULT_UART_BAUDRATE);
Driver_USART0.Initialize( NULL );
Driver_USART0.Control( ARM_USART_MODE_ASYNCHRONOUS, DEFAULT_UART_BAUDRATE );
}

void bsp_serial_print(char *str)
void bsp_serial_print( char * str )
{
(void)Driver_USART0.Send(str, strlen(str));
( void ) Driver_USART0.Send( str, strlen( str ) );
}

#if defined(__ARMCOMPILER_VERSION)
#if defined( __ARMCOMPILER_VERSION )

/* Retarget armclang, which requires all IO system calls to be overridden together. */

#include <rt_sys.h>
#include <rt_sys.h>

#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2

FILEHANDLE _sys_open(const char *name, int openmode)
{
if (name == NULL) {
return -1;
}

// By default, the Arm Compiler uses the special file path ":tt" for stdin,
// stdout and stderr and distinguishes between them using openmode. For details,
// see https://github.com/ARM-software/abi-aa/blob/2022Q1/semihosting/semihosting.rst#sys-open-0x01
if (strcmp(name, ":tt") == 0) {
if (openmode & OPEN_W) {
return STDOUT_FILENO;
}
if (openmode & OPEN_A) {
return STDERR_FILENO;
FILEHANDLE _sys_open( const char * name,
int openmode )
{
if( name == NULL )
{
return -1;
}
return STDIN_FILENO;
}

return -1;
}

int _sys_close(FILEHANDLE fh)
{
/* Not implemented */
(void)fh;
return -1;
}

int _sys_write(FILEHANDLE fd, const unsigned char *str, unsigned int len, int mode)
{
/* From <rt_sys.h>: `mode' exists for historical reasons and must be ignored. */
(void)mode;
/* By default, the Arm Compiler uses the special file path ":tt" for stdin, */
/* stdout and stderr and distinguishes between them using openmode. For details, */
/* see https://github.com/ARM-software/abi-aa/blob/2022Q1/semihosting/semihosting.rst#sys-open-0x01 */
if( strcmp( name, ":tt" ) == 0 )
{
if( openmode & OPEN_W )
{
return STDOUT_FILENO;
}

if( openmode & OPEN_A )
{
return STDERR_FILENO;
}

return STDIN_FILENO;
}

if (fd != STDOUT_FILENO && fd != STDERR_FILENO) {
return -1;
}

if (Driver_USART0.Send(str, len) != ARM_DRIVER_OK) {
int _sys_close( FILEHANDLE fh )
{
/* Not implemented */
( void ) fh;
return -1;
}

return 0;
}
int _sys_write( FILEHANDLE fd,
const unsigned char * str,
unsigned int len,
int mode )
{
/* From <rt_sys.h>: `mode' exists for historical reasons and must be ignored. */
( void ) mode;

if( ( fd != STDOUT_FILENO ) && ( fd != STDERR_FILENO ) )
{
return -1;
}

int _sys_read(FILEHANDLE fd, unsigned char *str, unsigned int len, int mode)
{
// From <rt_sys.h>: `mode' exists for historical reasons and must be ignored.
(void)mode;
if( Driver_USART0.Send( str, len ) != ARM_DRIVER_OK )
{
return -1;
}

/* Not implemented */
(void)str;
(void)len;
return -1;
}
return 0;
}

int _sys_istty(FILEHANDLE fh)
{
/* Not implemented */
(void)fh;
return 0;
}
int _sys_read( FILEHANDLE fd,
unsigned char * str,
unsigned int len,
int mode )
{
/* From <rt_sys.h>: `mode' exists for historical reasons and must be ignored. */
( void ) mode;

/* Not implemented */
( void ) str;
( void ) len;
return -1;
}

long _sys_flen(FILEHANDLE fh)
{
/* Not implemented */
(void)fh;
return -1;
}
int _sys_istty( FILEHANDLE fh )
{
/* Not implemented */
( void ) fh;
return 0;
}

int _sys_seek(FILEHANDLE fh, long offset)
{
/* Not implemented */
(void)fh;
(void)offset;
return -1;
}
long _sys_flen( FILEHANDLE fh )
{
/* Not implemented */
( void ) fh;
return -1;
}

int _sys_seek( FILEHANDLE fh,
long offset )
{
/* Not implemented */
( void ) fh;
( void ) offset;
return -1;
}

#else /* !defined(__ARMCOMPILER_VERSION) */

/* Redirects gcc printf to UART0 */
int _write(int fd, char *str, int len)
{
if (Driver_USART0.Send(str, len) == ARM_DRIVER_OK) {
return len;
int _write( int fd,
char * str,
int len )
{
if( Driver_USART0.Send( str, len ) == ARM_DRIVER_OK )
{
return len;
}

return 0;
}
return 0;
}

#endif
#endif /* if defined( __ARMCOMPILER_VERSION ) */
4 changes: 2 additions & 2 deletions Bsp/common/bsp_serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
/**
* \brief Initializes default UART device
*/
void bsp_serial_init(void);
void bsp_serial_init( void );

/**
* \brief Prints a string through the default UART device
*/
void bsp_serial_print(char *str);
void bsp_serial_print( char * str );

#endif /* __SERIAL_H__ */
4 changes: 2 additions & 2 deletions Config/freertos-config/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ void vLoggingPrintf( const char * pcFormat,

/* The address of an echo server that will be used by the two demo echo client
* tasks:
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Clients.html,
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/UDP_Echo_Clients.html. */
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Clients.html
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/UDP_Echo_Clients.html */
#define configECHO_SERVER_ADDR0 192
#define configECHO_SERVER_ADDR1 168
#define configECHO_SERVER_ADDR2 0
Expand Down
2 changes: 1 addition & 1 deletion Docs/aws-iot-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ Follow the instructions described in the sections listed below to create an IoT
thing for your device and attaching a policy to it.
* [IoT thing](#creating-an-iot-thing-for-your-device)
* [IoT policy](#creating-a-policy-and-attach-it-to-your-thing)
* [IoT policy](#creating-a-policy-and-attach-it-to-your-certificate)
### Creating roles and policies
Expand Down
Loading

0 comments on commit 3db02ff

Please sign in to comment.