mirror of
https://github.com/sipeed/MaixCDK.git
synced 2026-09-19 14:30:55 -05:00
fix linux compile error
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
# "nn",
|
# "nn",
|
||||||
# "json"
|
# "json"
|
||||||
# ]
|
# ]
|
||||||
|
# elif platform == "linux":
|
||||||
|
# return []
|
||||||
# else:
|
# else:
|
||||||
# raise Exception("maixcam_lib component.py not add this platform support yet")
|
# raise Exception("ahrs component.py not add this platform support yet")
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ config OMP_ENABLE
|
|||||||
bool "Enable omp"
|
bool "Enable omp"
|
||||||
default n if PLATFORM = "maixcam"
|
default n if PLATFORM = "maixcam"
|
||||||
default y if PLATFORM = "maixcam2"
|
default y if PLATFORM = "maixcam2"
|
||||||
|
default y if PLATFORM = "linux"
|
||||||
help
|
help
|
||||||
Enable OMP to accelerate performance on multi-core platforms.
|
Enable OMP to accelerate performance on multi-core platforms.
|
||||||
config OMP_ENABLE_DYNAMIC
|
config OMP_ENABLE_DYNAMIC
|
||||||
bool "Enable omp dynamic"
|
bool "Enable omp dynamic"
|
||||||
default n if PLATFORM = "maixcam"
|
default n if PLATFORM = "maixcam"
|
||||||
default n if PLATFORM = "maixcam2"
|
default n if PLATFORM = "maixcam2"
|
||||||
|
default y if PLATFORM = "linux"
|
||||||
depends on OMP_ENABLE
|
depends on OMP_ENABLE
|
||||||
help
|
help
|
||||||
Enable or disable dynamic adjustment of the number of threads in a parallel region
|
Enable or disable dynamic adjustment of the number of threads in a parallel region
|
||||||
|
|||||||
@@ -50,16 +50,9 @@ namespace maix::sys
|
|||||||
return "Unkonwn";
|
return "Unkonwn";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string maixpy_version()
|
std::string _get_maixpy_version_from_file(const std::string &version_path)
|
||||||
{
|
{
|
||||||
#if PLATFORM_MAIXCAM
|
std::ifstream version_file(version_path);
|
||||||
std::ifstream version_file("/usr/lib/python3.11/site-packages/maix/version.py");
|
|
||||||
#elif PLATFORM_MAIXCAM2
|
|
||||||
std::ifstream version_file("/usr/local/lib/python3.13/site-packages/maix/version.py");
|
|
||||||
#else
|
|
||||||
log::warn("maixpy_version() not implemented for this platform");
|
|
||||||
return "";
|
|
||||||
#endif
|
|
||||||
// fast way, read /usr/lib/python3.11/site-packages/maix/version.py
|
// fast way, read /usr/lib/python3.11/site-packages/maix/version.py
|
||||||
// find key value:
|
// find key value:
|
||||||
// version_major = 4
|
// version_major = 4
|
||||||
@@ -109,6 +102,19 @@ namespace maix::sys
|
|||||||
return version_stream.str();
|
return version_stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string maixpy_version()
|
||||||
|
{
|
||||||
|
#if PLATFORM_MAIXCAM
|
||||||
|
return _get_maixpy_version_from_file("/usr/lib/python3.11/site-packages/maix/version.py");
|
||||||
|
#elif PLATFORM_MAIXCAM2
|
||||||
|
return _get_maixpy_version_from_file("/usr/local/lib/python3.13/site-packages/maix/version.pyy");
|
||||||
|
#else
|
||||||
|
log::warn("maixpy_version() not implemented for this platform");
|
||||||
|
return "";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
std::string runtime_version()
|
std::string runtime_version()
|
||||||
{
|
{
|
||||||
fs::File *file = fs::open(LIB_VERSION_FILE_PATH, "r");
|
fs::File *file = fs::open(LIB_VERSION_FILE_PATH, "r");
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ namespace maix::comm
|
|||||||
}},
|
}},
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
|
std::map<std::string, std::map<std::string, std::string>> pins_map = {
|
||||||
|
};
|
||||||
log::warn("not set pinmap for this platform");
|
log::warn("not set pinmap for this platform");
|
||||||
#endif
|
#endif
|
||||||
auto it = pins_map.find(port_name);
|
auto it = pins_map.find(port_name);
|
||||||
@@ -113,6 +115,7 @@ namespace maix::comm
|
|||||||
{"uart2", "/dev/ttyS2"},
|
{"uart2", "/dev/ttyS2"},
|
||||||
// {"uart3", "/dev/ttyS3"},// default used by WiFi, to avoid error, we not use it.
|
// {"uart3", "/dev/ttyS3"},// default used by WiFi, to avoid error, we not use it.
|
||||||
};
|
};
|
||||||
|
return ports;
|
||||||
#elif PLATFORM_MAIXCAM2
|
#elif PLATFORM_MAIXCAM2
|
||||||
std::vector<std::vector<std::string>> ports = {
|
std::vector<std::vector<std::string>> ports = {
|
||||||
// {"uart0", "/dev/ttyS0"}, // debug serial, not used by default.
|
// {"uart0", "/dev/ttyS0"}, // debug serial, not used by default.
|
||||||
@@ -121,11 +124,11 @@ namespace maix::comm
|
|||||||
{"uart3", "/dev/ttyS3"},
|
{"uart3", "/dev/ttyS3"},
|
||||||
{"uart4", "/dev/ttyS4"}, // 6pin 1.25mm, default use this one.
|
{"uart4", "/dev/ttyS4"}, // 6pin 1.25mm, default use this one.
|
||||||
};
|
};
|
||||||
|
return ports;
|
||||||
#else
|
#else
|
||||||
log::warn("this platform no valid uart yet");
|
log::warn("this platform no valid uart yet");
|
||||||
return {};
|
return {};
|
||||||
#endif
|
#endif
|
||||||
return ports;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -260,14 +263,14 @@ namespace maix::comm
|
|||||||
auto ports = get_uart_ports();
|
auto ports = get_uart_ports();
|
||||||
#if PLATFORM_MAIXCAM
|
#if PLATFORM_MAIXCAM
|
||||||
std::string default_port = "uart0";
|
std::string default_port = "uart0";
|
||||||
auto default_device = _get_uart_device_by_name(default_port, ports);
|
std::string default_device = _get_uart_device_by_name(default_port, ports);
|
||||||
#elif PLATFORM_MAIXCAM2
|
#elif PLATFORM_MAIXCAM2
|
||||||
std::string default_port = "uart4";
|
std::string default_port = "uart4";
|
||||||
auto default_device = _get_uart_device_by_name(default_port, ports);
|
std::string default_device = _get_uart_device_by_name(default_port, ports);
|
||||||
#else
|
#else
|
||||||
log::warn("this platform no default uart yet");
|
log::warn("this platform no default uart yet");
|
||||||
std::string default_port = "";
|
std::string default_port = "";
|
||||||
auto default_device = "";
|
std::string default_device = "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto name = app::get_sys_config_kv("comm", "uart_port", "default");
|
auto name = app::get_sys_config_kv("comm", "uart_port", "default");
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ def add_requirements(platform : str, find_dirs : list):
|
|||||||
"nn",
|
"nn",
|
||||||
"json"
|
"json"
|
||||||
]
|
]
|
||||||
|
elif platform == "linux":
|
||||||
|
return []
|
||||||
else:
|
else:
|
||||||
raise Exception("maixcam_lib component.py not add this platform support yet")
|
raise Exception("llm component.py not add this platform support yet")
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -13,6 +13,7 @@ elseif(PLATFORM_MAIXCAM2)
|
|||||||
append_srcs_dir(ADD_SRCS "port/maixcam2")
|
append_srcs_dir(ADD_SRCS "port/maixcam2")
|
||||||
list(APPEND ADD_REQUIREMENTS eigen librosa_simple OpenCC onnxruntime)
|
list(APPEND ADD_REQUIREMENTS eigen librosa_simple OpenCC onnxruntime)
|
||||||
else()
|
else()
|
||||||
|
list(APPEND ADD_PRIVATE_INCLUDE "port/linux")
|
||||||
append_srcs_dir(ADD_SRCS "port/linux")
|
append_srcs_dir(ADD_SRCS "port/linux")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ def add_requirements(platform : str, find_dirs : list):
|
|||||||
"OpenCC",
|
"OpenCC",
|
||||||
"onnxruntime"
|
"onnxruntime"
|
||||||
])
|
])
|
||||||
|
elif platform == "linux":
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
raise Exception("maixcam_lib component.py not add this platform support yet")
|
raise Exception("nn component.py not add this platform support yet")
|
||||||
return reqs
|
return reqs
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
13
components/nn/port/linux/maix_nn_linux.cpp
Normal file
13
components/nn/port/linux/maix_nn_linux.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
#include "maix_nn.hpp"
|
||||||
|
|
||||||
|
namespace maix::nn
|
||||||
|
{
|
||||||
|
err::Err mud_load_raw_model(const std::string &model_path, MUD *mud_obj)
|
||||||
|
{
|
||||||
|
log::error("mud_load_raw_model not impl yet");
|
||||||
|
return err::ERR_NOT_IMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace maix::nn
|
||||||
|
|
||||||
9
components/nn/port/linux/maix_nn_linux.hpp
Normal file
9
components/nn/port/linux/maix_nn_linux.hpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include "global_config.h"
|
||||||
|
#include "maix_nn.hpp"
|
||||||
|
#include "maix_image.hpp"
|
||||||
|
|
||||||
|
namespace maix::nn
|
||||||
|
{
|
||||||
|
err::Err mud_load_raw_model(const std::string &model_path, MUD *mud_obj);
|
||||||
|
|
||||||
|
} // namespace maix::nn
|
||||||
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#if PLATFORM_MAIXCAM || PLATFORM_MAIXCAM2
|
#if PLATFORM_MAIXCAM || PLATFORM_MAIXCAM2
|
||||||
#include "maix_nn_maixcam.hpp"
|
#include "maix_nn_maixcam.hpp"
|
||||||
|
#else
|
||||||
|
#include "maix_nn_linux.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1067,6 +1067,7 @@ namespace maix::camera
|
|||||||
int height;
|
int height;
|
||||||
void *buff;
|
void *buff;
|
||||||
bool buff_alloc;
|
bool buff_alloc;
|
||||||
|
bool _is_opened;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::string> list_devices()
|
std::vector<std::string> list_devices()
|
||||||
@@ -1429,6 +1430,11 @@ namespace maix::camera
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<int> get_sensor_size()
|
||||||
|
{
|
||||||
|
return {0, 0};
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> Camera::get_sensor_size() {
|
std::vector<int> Camera::get_sensor_size() {
|
||||||
return {0, 0};
|
return {0, 0};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "maix_pipeline.hpp"
|
#include "maix_pipeline.hpp"
|
||||||
#include "ax_middleware.hpp"
|
|
||||||
|
|
||||||
namespace maix::pipeline {
|
namespace maix::pipeline {
|
||||||
Stream::Stream(void *stream, bool auto_delete, std::string from) {
|
Stream::Stream(void *stream, bool auto_delete, std::string from) {
|
||||||
|
|||||||
Reference in New Issue
Block a user