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

Enable multi binary native communication over WebSockets #417

Merged
merged 43 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
47d02a6
[Robus] Add HAL_loop function
nicolas-rabault Oct 28, 2022
9bb0a76
Fix Native clock to be MS
nicolas-rabault Nov 10, 2022
438ed14
[Gate] Remove some useless delay
nicolas-rabault Nov 15, 2022
5249c2c
[Pipe] Speed up websockets polling
nicolas-rabault Nov 15, 2022
6b8f86e
[Pipe] Fix web socket closing event
Jan 26, 2023
2c4c285
Add mongoose management on HAL
nicolas-rabault Oct 28, 2022
64a18cb
Add thread dependancies for native on linux
Jan 12, 2023
0c41737
Add a Native WS HAL emulating Robus.
nicolas-rabault Nov 3, 2022
757f1e1
Add a python broker with requirements.txt to install.
nicolas-rabault Nov 23, 2022
52beb75
[Gate] Add an optional GATE_REFRESH_TIME_S configuration disabling th…
nicolas-rabault Nov 22, 2022
b6a81a6
Create a thread lock unlock mutex macro
nicolas-rabault Dec 5, 2022
0a66985
Add thread locks macro avoiding data-race with HAL threads.
nicolas-rabault Dec 12, 2022
eef90ac
[Naitve] Declare boards drawings as const vars
nicolas-rabault Dec 19, 2022
4304a7c
[Native] Clean the led code
nicolas-rabault Dec 19, 2022
14eaeaf
[Native] Remove the button package from Gate_wscom example
nicolas-rabault Dec 21, 2022
3ffdaa4
Unpack Luos_task_t because it should not be packed
nicolas-rabault Dec 19, 2022
dcdd0b6
Add sanity assert
nicolas-rabault Jan 6, 2023
99c0f22
Add thread locks macro avoiding data-race with polling services threads.
nicolas-rabault Jan 27, 2023
e69e5bc
Multi task services on the GateWS example
nicolas-rabault Jan 6, 2023
b49d038
Fix assert macro
Jan 24, 2023
db49024
[Pipe] Add a configurable PIPE_WS_SERVER_ADDR
nicolas-rabault Jan 27, 2023
ea2b5e0
Add a Native WS broker address compilation option
nicolas-rabault Jan 27, 2023
a17f76c
Add native broker option to setup IP and port of the server.
nicolas-rabault Jan 27, 2023
0d99fdb
Update .gitignore
Jan 26, 2023
dd68708
Fix double declaration in native gate
Feb 3, 2023
a1fa9c6
Download mongoose only one time even if it's used by multiple libs.
Jan 13, 2023
ee7a05e
Create a PingPong game example
nicolas-rabault Jan 27, 2023
217ffcd
improvement
nicolas-rabault Jan 27, 2023
ec785da
multi-threading + a lot of improvement and fun
nicolas-rabault Jan 27, 2023
7d09c11
Add enviro sounds in the game
nicolas-rabault Jan 27, 2023
2d4f39a
Docker implmentation
K0rdan Jan 30, 2023
80e25ed
Create a separate thread for gaph
nicolas-rabault Jan 31, 2023
7673804
Gaphism improvement
nicolas-rabault Jan 31, 2023
d4fb1c7
Add net animations
BiliouriV Jan 31, 2023
8ff206d
Add scoring management
nicolas-rabault Jan 31, 2023
84ca9b5
final improvement of controls, displays, and readme
nicolas-rabault Feb 3, 2023
5a69455
Fix unit test for message alloc pull message
Jan 12, 2023
5a04696
Remove unused _WEAKED symbol
Mar 28, 2023
462a026
Fix typos
Mar 31, 2023
674fa15
Prevent streaming asserts on windows
Mar 31, 2023
2444e27
Boost buffers for windows
Mar 31, 2023
5c3fa29
increase PTP acknowledge timeout for windows
Mar 31, 2023
7bc59ce
increase timeout for failed detection on windows
Mar 31, 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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@
/examples/projects/SAMD21XPLAINED/bootloader/firmware/luos_bootloader_samd21j18a.X/build/
/examples/projects/SAMD21XPLAINED/bootloader/firmware/luos_bootloader_samd21j18a.X/.generated_files/
/examples/projects/SAMD21XPLAINED/bootloader/firmware/luos_bootloader_samd21j18a.X/dist/


mongoose/
17 changes: 17 additions & 0 deletions engine/HAL/ATSAMD21/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@
#define MCUFREQ 48000000 // MCU frequence
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* BOOTLOADER CONFIG
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/ATSAMD21_ARDUINO/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@
#define MCUFREQ 48000000 // MCU frequence
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* BOOTLOADER CONFIG
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/ATSAMD21_MBED/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@
#ifndef MCUFREQ
#define MCUFREQ 48000000 // MCU frequence
#endif
/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* FLASH CONFIG
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/ESP32/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@
#define MCUFREQ APB_CLK_FREQ // MCU frequence
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* FLASH CONFIG
******************************************************************************/
Expand Down
31 changes: 28 additions & 3 deletions engine/HAL/NATIVE/luos_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include <time.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>

pthread_mutex_t mutex_msg_alloc = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex_luos = PTHREAD_MUTEX_INITIALIZER;

/*******************************************************************************
* Function
Expand Down Expand Up @@ -65,8 +69,23 @@ static void LuosHAL_SystickInit(void)
******************************************************************************/
uint32_t LuosHAL_GetSystick(void)
{
clock_t tick = clock();
return tick; // return tick
struct timespec time;
uint32_t ms; // Milliseconds
time_t s; // Seconds
#ifdef linux
clock_gettime(CLOCK_BOOTTIME, &time);
#else
clock_gettime(CLOCK_MONOTONIC, &time);
#endif
s = time.tv_sec;
ms = round(time.tv_nsec / 1.0e6); // Convert nanoseconds to milliseconds
if (ms > 999)
{
s++;
ms = 0;
}
ms += s * 1000;
return ms;
}

/******************************************************************************
Expand All @@ -76,7 +95,13 @@ uint32_t LuosHAL_GetSystick(void)
******************************************************************************/
uint64_t LuosHAL_GetTimestamp(void)
{
return (LuosHAL_GetSystick() * 1000);
struct timespec time;
#ifdef linux
clock_gettime(CLOCK_BOOTTIME, &time);
#else
clock_gettime(CLOCK_MONOTONIC, &time);
#endif
return time.tv_nsec;
}

/******************************************************************************
Expand Down
20 changes: 20 additions & 0 deletions engine/HAL/NATIVE/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@
static uint32_t stub_flash_x86[FLASH_PAGE_NUMBER][FLASH_PAGE_SIZE];
static uint32_t *last_page_stub_flash_x86 = &stub_flash_x86[FLASH_PAGE_NUMBER - 1][FLASH_PAGE_SIZE];

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#include <pthread.h>
extern pthread_mutex_t mutex_msg_alloc;
extern pthread_mutex_t mutex_luos;

#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK pthread_mutex_lock(&mutex_msg_alloc);
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK pthread_mutex_unlock(&mutex_msg_alloc);
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK pthread_mutex_lock(&mutex_luos);
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK pthread_mutex_unlock(&mutex_luos);
#endif
/*******************************************************************************
* FLASH CONFIG
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/STM32F0/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@
#define MCUFREQ 48000000 // MCU frequence
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* BOOTLOADER CONFIG
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/STM32F4/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@
#define MCUFREQ 168000000 // MCU frequence 168000000
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* BOOTLOADER CONFIG
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/STM32G4/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@
#define MCUFREQ 170000000 // MCU frequence
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* BOOTLOADER CONFIG
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/STM32L0/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@
#define MCUFREQ 32000000 // MCU frequence
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* BOOTLOADER CONFIG
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/STM32L4/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@
#define MCUFREQ 80000000 // MCU frequence
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* BOOTLOADER CONFIG
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/STUB/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@
#define MCUFREQ 100000000 // MCU frequence
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* DEFINE STUB FLASH FOR X86
******************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions engine/HAL/template/luos_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@
#define MCUFREQ // MCU frequence
#endif

/*******************************************************************************
* DEFINE THREAD MUTEX LOCKING AND UNLOCKING FUNCTIONS
******************************************************************************/
#ifndef MSGALLOC_MUTEX_LOCK
#define MSGALLOC_MUTEX_LOCK
#endif
#ifndef MSGALLOC_MUTEX_UNLOCK
#define MSGALLOC_MUTEX_UNLOCK
#endif

#ifndef LUOS_MUTEX_LOCK
#define LUOS_MUTEX_LOCK
#endif
#ifndef LUOS_MUTEX_UNLOCK
#define LUOS_MUTEX_UNLOCK
#endif

/*******************************************************************************
* BOOTLOADER CONFIG
******************************************************************************/
Expand Down
5 changes: 0 additions & 5 deletions engine/core/inc/luos_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@

#define LUOS_RUN() Luos_Run();

#ifndef _WEAKED
#define _WEAKED
#endif

/******************************************************************************
* @struct general_stats_t
* @brief format all datas to be sent trough msg
Expand Down Expand Up @@ -54,7 +50,6 @@ void Luos_Init(void);
void Luos_Loop(void);

// ***************** Node management *****************
uint32_t Luos_GetSystick(void);
void Luos_ResetStatistic(void);
bool Luos_IsNodeDetected(void);
void Luos_SetVerboseMode(uint8_t mode);
Expand Down
2 changes: 1 addition & 1 deletion engine/core/inc/luos_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if (!(expr)) \
Luos_assert((char *)__FILE__, __LINE__)
#else
#define LUOS_ASSERT(expr) ()
#define LUOS_ASSERT(expr)
#endif

/* This structure is used to manage node assertion informations
Expand Down
Loading