Skip to content

Commit

Permalink
Expose packages functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-rabault committed Jan 23, 2024
1 parent fa90239 commit 5035fee
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
25 changes: 11 additions & 14 deletions engine/HAL/BROWSER/hal_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# Global env, use it if you call this script from a library.json file
genv = DefaultEnvironment()


def shared_lib(source, target, env):
# Try to find the luos_engine.a somwhere on $BUILD_DIR/*/ archive and save it to a libPath variable
libPath = None
Expand All @@ -31,18 +30,17 @@ def shared_lib(source, target, env):
if platform.system() == 'Darwin':
cheerp_bin_path = '/Applications/cheerp/bin'

if platform.system() == 'Darwin':
# Create a symlink to Cheerp clang++ in gcc
try:
os.symlink(cheerp_bin_path + '/clang++', cheerp_bin_path + '/gcc')
except FileExistsError:
pass
# Create a symlink to Cheerp clang++ in gcc
try:
os.symlink(cheerp_bin_path + '/clang++', cheerp_bin_path + '/gcc')
except FileExistsError:
pass

# Create a symlink to Cheerp clang++ in g++
try:
os.symlink(cheerp_bin_path + '/clang++', cheerp_bin_path + '/g++')
except FileExistsError:
pass
# Create a symlink to Cheerp clang++ in g++
try:
os.symlink(cheerp_bin_path + '/clang++', cheerp_bin_path + '/g++')
except FileExistsError:
pass

# Add the cheerp fake gcc path at the beginning of the PATH environment variable than platformio will use it by default
current_path = os.environ.get('PATH', '')
Expand All @@ -53,7 +51,7 @@ def shared_lib(source, target, env):

for e in [env, genv]:
# Add the cheerp-wasm target to the compiler flags
e.Append(CCFLAGS=["--target=cheerp-wasm"])
e.Append(CCFLAGS=["--target=cheerp-wasm", "-Wno-cheerp", "-DPUBLIC=__attribute__\(\(cheerp_jsexport\)\)"])

# Add the cheerp-wasm target to the linker flags
e.Append(LINKFLAGS=["--target=cheerp-wasm", "-cheerp-pretty-code"])
Expand All @@ -66,5 +64,4 @@ def shared_lib(source, target, env):
e.Replace(PROGNAME="program.js")

# Add the shared_lib callback to the buildprog post action
print("Adding the shared_lib callback to the buildprog post action")
genv.AddPostAction("$PROGPATH", shared_lib)
4 changes: 4 additions & 0 deletions engine/core/inc/luos_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#define LUOS_ASSERT(expr)
#endif

#ifndef PUBLIC
#define PUBLIC
#endif

/* This structure is used to manage node assertion informations
*/
typedef struct __attribute__((__packed__))
Expand Down
4 changes: 2 additions & 2 deletions engine/core/src/luos_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static inline void Luos_PackageLoop(void);
* @param None
* @return None
******************************************************************************/
void Luos_Init(void)
PUBLIC void Luos_Init(void)
{
Service_Init();
Node_Init();
Expand All @@ -56,7 +56,7 @@ void Luos_Init(void)
* @param None
* @return None
******************************************************************************/
void Luos_Loop(void)
PUBLIC void Luos_Loop(void)
{
static uint32_t last_loop_date;
phy_job_t *job = NULL;
Expand Down
4 changes: 2 additions & 2 deletions examples/projects/browser/led/lib/Led/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void clear_screen(void)
* @param None
* @return None
******************************************************************************/
void Led_Init(void)
PUBLIC void Led_Init(void)
{
revision_t revision = {.major = 1, .minor = 0, .build = 0};
Luos_CreateService(Led_MsgHandler, STATE_TYPE, "led", revision);
Expand All @@ -82,7 +82,7 @@ void Led_Init(void)
* @param None
* @return None
******************************************************************************/
void Led_Loop(void) {}
PUBLIC void Led_Loop(void) {}

/******************************************************************************
* @brief Msg manager callback when a msg receive for this service
Expand Down
4 changes: 2 additions & 2 deletions network/ws_network/src/ws_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ volatile wait_ack_t ping_status = INACTIVE; // This flag indicate the status of
* @param None
* @return None
******************************************************************************/
void Ws_Init(void)
PUBLIC void Ws_Init(void)
{
// Instantiate the phy struct
phy_ws = Phy_Create(Ws_JobHandler, Ws_RunTopology, Ws_Reset);
Expand All @@ -117,7 +117,7 @@ void Ws_Reset(luos_phy_t *phy_ptr)
* @param None
* @return None
******************************************************************************/
void Ws_Loop(void)
PUBLIC void Ws_Loop(void)
{
WsHAL_Loop();
}
Expand Down

0 comments on commit 5035fee

Please sign in to comment.