Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1baff4a
Add argv
Cantonplas Feb 28, 2025
4935f21
Works, i think
Cantonplas Feb 28, 2025
2d7a243
Fix repo name problem
Cantonplas Feb 28, 2025
f50722b
Created variable board
Cantonplas Mar 1, 2025
3285604
Merge branch 'Code_generation_fix' into FW-301/Execute_Code_gen_on_cmake
Cantonplas Mar 3, 2025
35fc114
Some changes
Cantonplas Mar 6, 2025
5b167af
Merge branch 'Code_generation_fix' into FW-301/Execute_Code_gen_on_cmake
Cantonplas Mar 26, 2025
b9dc5af
Merge branch 'FW-301/Execute_Code_gen_on_cmake' of https://github.com…
Cantonplas Mar 26, 2025
e0ffbc2
Changed generator.py and cmakelist, now cmakelist board needs to be m…
Cantonplas Mar 26, 2025
62bf0c4
Merge branch 'main' into FW-301/Execute_Code_gen_on_cmake
Cantonplas Apr 9, 2025
ec302cd
Changes on cmake and some tests for making the github actions work
Cantonplas Apr 9, 2025
321ebfd
Testing to delete the results of the generation for github actions
Cantonplas Apr 9, 2025
1e1ca84
The test didnt work again
Cantonplas Apr 9, 2025
ab5ee07
Uploaded the folder so that it works
Cantonplas Apr 9, 2025
55f1c66
Merge branch 'main' into FW-301/Execute_Code_gen_on_cmake
Cantonplas Jun 5, 2025
0e82c9f
Temporal changes
Cantonplas Aug 31, 2025
2d4eccb
Changed packet description structure and how it reads adj, works fine
Cantonplas Sep 1, 2025
b2fd7be
Deleted generated code
Cantonplas Sep 1, 2025
ff301c6
Silly change that makes it so it doesnt explode when you put a wrong …
Cantonplas Sep 1, 2025
69116f1
Merge branch 'main' into FW-301/Execute_Code_gen_on_cmake
Cantonplas Sep 9, 2025
52814b9
Sockets are now created automatically
Cantonplas Sep 10, 2025
623bcc0
Missed a _, now working
Cantonplas Sep 10, 2025
91b8c40
Autogenerated code now creates sockets and send packets on a set peri…
Cantonplas Sep 10, 2025
789ac6e
Working version, testing to be done
Cantonplas Sep 10, 2025
f845aa5
Testing in course
Cantonplas Sep 10, 2025
ed703ab
New version now creates sockets and sends the packets correctly
Cantonplas Sep 11, 2025
85c1e62
Updated deps
Cantonplas Sep 11, 2025
4c9e8d4
Fixed Order Packets, now working
Cantonplas Sep 11, 2025
485b4fa
Deleted generated code
Cantonplas Sep 13, 2025
2bbf1e9
Update Core/Inc/Code_generation/Packet_generation/Packet_generation.py
Cantonplas Jan 20, 2026
47075b7
Merge remote-tracking branch 'origin/main' into FW-301/Execute_Code_g…
Cantonplas Jan 22, 2026
5c58756
Merge branch 'FW-301/Execute_Code_gen_on_cmake' of https://github.com…
Cantonplas Jan 22, 2026
c6aa833
6 months later maybe this time we can aprove this pr
Cantonplas Jan 22, 2026
788b26c
Deleted generated code
Cantonplas Jan 22, 2026
2833d51
Deps update and deleted comments
Cantonplas Jan 23, 2026
01cca43
Merge branch 'main' into FW-301/Execute_Code_gen_on_cmake
Cantonplas Jan 23, 2026
7cb761b
Now it works
Cantonplas Jan 23, 2026
0d8274b
virtual\scripts\python is wrong, also Wpedantic needs to be removed
victor-Lopez25 Jan 31, 2026
bb2af32
remove htim* from runes.cpp, I thought I removed this before...
victor-Lopez25 Jan 31, 2026
f140ad4
remove virtual/Scripts/python from tasks.json
victor-Lopez25 Jan 31, 2026
c7c9b79
Merge remote-tracking branch 'origin/hotfix(hal_conf)-Add-SD-define' …
Cantonplas Feb 2, 2026
9b29433
Hotfix code generation
Cantonplas Feb 2, 2026
bfa7450
Merge remote-tracking branch 'origin/hotfix!-virtualbinpython-always-…
Cantonplas Feb 2, 2026
7e1fcd1
Now packets dont duplicate constructor variables
Cantonplas Feb 2, 2026
00cd59b
Merge branch 'main' into FW-301/Execute_Code_gen_on_cmake
Cantonplas Feb 2, 2026
13c49ca
Revert "Merge remote-tracking branch 'origin/hotfix!-virtualbinpython…
Cantonplas Feb 2, 2026
89491df
Remove pedantic from cmake
Cantonplas Feb 2, 2026
7670425
Modify OrderPackets class to include public access
Cantonplas Feb 2, 2026
18c2a93
Cleanup template and output
victor-Lopez25 Feb 2, 2026
a366abe
Further cleanup templates and output
victor-Lopez25 Feb 3, 2026
2fdb4d8
Functions per packet implemented
Cantonplas Feb 3, 2026
2043c87
Now flags and cb are generated
Cantonplas Feb 3, 2026
7073fdd
New update method
Cantonplas Feb 3, 2026
74d2ba7
Testing stuff
Cantonplas Feb 3, 2026
6325de4
Hope its the final version jesus
Cantonplas Feb 3, 2026
9813b0e
Change public and private from datapackets that was incorrect
Cantonplas Feb 3, 2026
effb9d7
Rename .gitignore to .gitkeep
Cantonplas Feb 3, 2026
3f6ea0a
Deleted self scheduler
Cantonplas Feb 4, 2026
776b77d
Pene
Cantonplas Feb 4, 2026
e5e22ad
Espacio extra que victor le gusta
Cantonplas Feb 4, 2026
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ target_compile_options(${EXECUTABLE} PRIVATE
$<$<COMPILE_LANGUAGE:C>:-w>

$<$<COMPILE_LANGUAGE:CXX>:-Wall>
$<$<COMPILE_LANGUAGE:CXX>:-Wpedantic>
# $<$<COMPILE_LANGUAGE:CXX>:-Wpedantic>
$<$<COMPILE_LANGUAGE:CXX>:-Werror>
$<$<COMPILE_LANGUAGE:CXX>:-fno-use-cxa-atexit>
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
Expand Down
2 changes: 1 addition & 1 deletion Core/Inc/Code_generation/JSON_ADE
85 changes: 52 additions & 33 deletions Core/Inc/Code_generation/Packet_generation/DataTemplate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,62 @@

//Data packets for {{board}} -AUTOGENERATED CODE, DO NOT MODIFY-
class DataPackets{
public:
{% for enum in enums %}enum class {{enum.name}}:uint8_t
public:
{% for enum in enums -%}
enum class {{enum.name}} : uint8_t
{
{% for value in enum["values"] %}{{value}}={{loop.index0}}{%if not loop.last%},{%endif%}
{% endfor %}};

{%endfor %}

private:
inline static uint32_t id{0};
public:
{%for packet in packets%}static inline HeapPacket* {{packet.name}}{};
{% endfor %}

{% for socket in sockets %}static inline {{socket.type}}* {{socket.name}} = nullptr;
{% endfor %}

DataPackets({%for value in data %}{{value.type}} &{{value.name}}{%if not loop.last%},{%endif%}{%endfor%})
{
{% for socket in ServerSockets%}{{socket.name}} = new ServerSocket("{{socket.board_ip}}",{{socket.port}});
{%- for value in enum["values"] %}
{{value}} = {{loop.index0}},
{%- endfor %}
};
{% endfor %}
{% for socket in DatagramSockets%}{{socket.name}} = new DatagramSocket("{{socket.board_ip}}",{{socket.port}},"{{socket.remote_ip}}",{{socket.port}});

{% for packet in packets -%}
static void {{packet.name}}_init({% for variable in packet.variables %}{{variable.type}} &{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %})
{
{{packet.name}} = new HeapPacket(static_cast<uint16_t>({{packet.id}}){% if packet.variables %}, {% for variable in packet.variables %}&{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %});
}

{% endfor -%}

public:
{%for packet in packets -%}
inline static HeapPacket *{{packet.name}}{nullptr};
{% endfor %}
{% for socket in Sockets%}{{socket.name}} = new Socket("{{socket.board_ip}}",{{socket.local_port}},"{{socket.remote_ip}}",{{socket.remote_port}});
{% for socket in sockets -%}
inline static {{socket.type}} *{{socket.name}}{nullptr};
{% endfor %}
{% for packet in packets %}{{packet.name}} = new HeapPacket(static_cast<uint16_t>({{packet.id}}){% if packet.data%},{{packet.data}}{% endif%});

static void start()
{
{% for packet in packets -%}
if ({{packet.name}} == nullptr) {
ErrorHandler("Packet {{packet.name}} not initialized");
}
{% endfor %}

{% endfor %}
{%for packet in sending_packets %}Scheduler::register_task({% if packet.period_type == "ms" %}{{(packet.period*1000)}}{% else %}{{packet.period}}{% endif %},+[](){
{% if packet.name is string %} DataPackets::{{packet.socket}}->send_packet(*DataPackets::{{packet.name}});
{%else%}
{%for name in packet.name%}DataPackets::{{packet.socket}}->send_packet(*{{name}});
{%endfor%}
{% endif %}
});
{%endfor%}
{% for socket in ServerSockets -%}
{{socket.name}} = new ServerSocket("{{socket.board_ip}}",{{socket.port}});
{%- endfor %}
{% for socket in DatagramSockets -%}
{{socket.name}} = new DatagramSocket("{{socket.board_ip}}",{{socket.port}},"{{socket.remote_ip}}",{{socket.port}});
{% endfor %}
{% for socket in Sockets -%}
{{socket.name}} = new Socket("{{socket.board_ip}}",{{socket.local_port}},"{{socket.remote_ip}}",{{socket.remote_port}});
{% endfor %}

{%- for packet in sending_packets %}
Scheduler::register_task({% if packet.period_type == "ms" %}{{ (packet.period*1000)|round|int }}{% else %}{{ packet.period|round|int }}{% endif %}, +[](){
{% if packet.name is string -%}
DataPackets::{{packet.socket}}->send_packet(*DataPackets::{{packet.name}});
{% else %}
{% for name in packet.name -%}
DataPackets::{{packet.socket}}->send_packet(*DataPackets::{{name}});
{% endfor -%}
{%- endif %}
}); {%- endfor %}
}


}
};
};
47 changes: 30 additions & 17 deletions Core/Inc/Code_generation/Packet_generation/OrderTemplate.hpp
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
#pragma once
#include "ST-LIB.hpp"

//Order packets for {{board}} -AUTOGENERATED CODE, DO NOT MODIFY-
/*Order packets for {{board}}
-AUTOGENERATED CODE, DO NOT MODIFY- */


{%for packet in packets%}extern void {{packet.name}}_cb();
{% endfor %}
class OrderPackets{
{% for enum in enums %}enum class {{enum.name}}:uint8_t
public:
{% for enum in enums -%}
enum class {{enum.name}} : uint8_t
{
{% for value in enum["values"] %}{{value}}={{loop.index0}}{%if not loop.last%},{%endif%}
{% endfor %}};
{%- for value in enum["values"] %}
{{value}} = {{loop.index0}},
{%- endfor %}
};
{% endfor %}

{% for packet in packets -%}
inline static bool {{packet.name}}_flag{false};
{% endfor %}


OrderPackets() = default;

private:
uint32_t id{0};
public:
{%for packet in packets%}HeapOrder* {{packet.name}};
{% endfor %}

OrderPackets({%for value in data %}{{value.type}} &{{value.name}}{%if not loop.last%},{%endif%}{%endfor%})
{
{% for packet in packets -%}
inline static HeapOrder *{{packet.name}}{nullptr};
{% endfor %}

{% for packet in packets -%}
static void {{packet.name}}_init({% for variable in packet.variables %}{{variable.type}} &{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %})
{
{{packet.name}} = new HeapOrder({{packet.id}}, &{{packet.name}}_cb{% if packet.variables %}, {% for variable in packet.variables %}&{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %});
}
{% endfor %}

{% for packet in packets %}{{packet.name}}=new HeapOrder({{packet.id}},&{{packet.name}}_cb{% if packet.data%},{{packet.data}}{% endif%});
private:
{% for packet in packets -%}
static void {{packet.name}}_cb()
{
{{packet.name}}_flag = true;
}
{% endfor %}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,6 @@ def _unsigned_int_correction(type:str):
type += "_t"
elif type == "float32":
type = "float"
elif type == "float64":
type = "double"
return type
25 changes: 21 additions & 4 deletions Core/Inc/Code_generation/Packet_generation/Packet_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,20 @@ def GenerateDataPackets(board:BoardDescription):
tempdata = tempdata[:-1]
if tempdata_but_pointer.endswith(","):
tempdata_but_pointer = tempdata_but_pointer[:-1]
aux_packet = {"name": packet_instance.name, "data":tempdata_but_pointer.replace(" ", "_").replace("-", "_") , "id": packet_instance.id}

packet_variables = []
for measurement in packet_instance.measurements:
packet_variables.append({
"name": measurement.id.replace(" ", "_").replace("-", "_"),
"type": measurement.type
})

aux_packet = {"name": packet_instance.name, "data":tempdata_but_pointer.replace(" ", "_").replace("-", "_") , "id": packet_instance.id, "variables": packet_variables}
Packets.append(aux_packet)
for measurement in packet_instance.measurements:
aux_data = {"type": measurement.type, "name": measurement.id.replace(" ", "_").replace("-", "_")}
totaldata.append(aux_data)
if not any(x["name"] == aux_data["name"] for x in totaldata):
totaldata.append(aux_data)

return Packets,totaldata

Expand Down Expand Up @@ -120,11 +129,19 @@ def GenerateOrderPackets(board:BoardDescription):
if tempdata.endswith(","):
tempdata = tempdata[:-1]
tempdata_but_pointer = tempdata_but_pointer[:-1]
aux_packet = {"name": packet_instance.name, "data":tempdata_but_pointer , "id": packet_instance.id}

packet_variables = []
for measurement in packet_instance.measurements:
packet_variables.append({
"name": measurement.id.replace(" ", "_").replace("-", "_"),
"type": measurement.type
})

aux_packet = {"name": packet_instance.name, "data":tempdata_but_pointer , "id": packet_instance.id, "variables": packet_variables}
Packets.append(aux_packet)
for measurement in packet_instance.measurements:
aux_data = {"type": measurement.type, "name": measurement.id}
if aux_data not in totaldata:
if not any(x["name"] == aux_data["name"] for x in totaldata):
totaldata.append(aux_data)

return Packets,totaldata
Expand Down
Empty file.
1 change: 1 addition & 0 deletions Core/Inc/Communications/Packets/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 0 additions & 4 deletions Core/Inc/stm32h7xx_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ void DMA2_Stream0_IRQHandler(void);
void DMA2_Stream1_IRQHandler(void);
void DMA2_Stream2_IRQHandler(void);
void FMAC_IRQHandler(void);
void TIM2_IRQHandler(void);
void I2C2_EV_IRQHandler(void);
void TIM8_TRG_COM_TIM14_IRQHandler(void);
void TIM5_IRQHandler(void);
void SPI3_IRQHandler(void);
void TIM7_IRQHandler(void);
void ETH_IRQHandler(void);
void LPTIM1_IRQHandler(void);
void LPTIM2_IRQHandler(void);
Expand Down
6 changes: 3 additions & 3 deletions Core/Src/Runes/generated_metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
extern "C"{
const char DESCRIPTION[255] __attribute__((section(".metadata_pool")))=
"****************" // placeholder for beggining
"20260123T210152" // DateTime using ISO-8601 format
"20260202T130943" // DateTime using ISO-8601 format
" " // alignment
"332e04d7" // STLIB commit
"20be5ece" // STLIB commit
"--------" // ADJ commit
"01cca436" // Board commit
"c7c9b795" // Board commit
// the '=' is used for unparsing
;
}
2 changes: 1 addition & 1 deletion deps/ST-LIB