Skip to content

Commit c34f9c3

Browse files
committed
use new cmake support in jd-c
1 parent ec20189 commit c34f9c3

File tree

6 files changed

+27
-21
lines changed

6 files changed

+27
-21
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,17 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)
55
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=esp_panic_handler" APPEND)
66
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=uart_hal_write_txfifo" APPEND)
77
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=panic_restart" APPEND)
8+
# force linking of ctrl.c
9+
idf_build_set_property(LINK_OPTIONS "-u app_get_device_class" APPEND)
810

911
project(espjd)
12+
13+
# this passes the esp-idf compile options down to jacdac-c build
14+
idf_build_get_property(compile_options COMPILE_OPTIONS GENERATOR_EXPRESSION)
15+
idf_build_get_property(c_compile_options C_COMPILE_OPTIONS GENERATOR_EXPRESSION)
16+
add_compile_options("${compile_options}")
17+
add_c_compile_options("${c_compile_options}")
18+
19+
# location of jd_user_config.h
20+
set(JACDAC_USER_CONFIG_DIR "../main")
21+
add_subdirectory(jacdac-c)

main/CMakeLists.txt

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
1-
file(GLOB JDC_FILES
2-
../jacdac-c/jacscript/*.c
3-
../jacdac-c/source/*.c
4-
../jacdac-c/client/*.c
5-
../jacdac-c/storage/*.c
6-
../jacdac-c/storage/ff/*.c
1+
file(GLOB MAIN_FILES
72
*.c
83
)
94

105
idf_component_register(
116
SRCS
127
"../build/version.c"
13-
"../jacdac-c/source/interfaces/event_queue.c"
14-
"../jacdac-c/source/interfaces/simple_rx.c"
15-
"../jacdac-c/source/interfaces/tx_queue.c"
16-
"../jacdac-c/services/jd_status_light.c"
17-
"../jacdac-c/services/power.c"
18-
"../jacdac-c/jacdac/dist/c/jd_spec_pack.c"
19-
${JDC_FILES}
8+
${MAIN_FILES}
209

2110
INCLUDE_DIRS
2211
"."
23-
"../jacdac-c/inc"
24-
"../jacdac-c/jacscript"
25-
"../jacdac-c"
26-
)
12+
)
13+
14+
target_link_libraries(${COMPONENT_LIB} PUBLIC jacdac)

main/hw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include <string.h>
33
#include <stdbool.h>
44

5+
#include "sdkconfig.h"
6+
57
#include "dmesg.h"
68

79
#include "freertos/FreeRTOS.h"

main/jd_user_config.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
#define DEVICE_DMESG_BUFFER_SIZE 4096
55

66
#include "dmesg.h"
7-
#include "sdkconfig.h"
87

98
#define JD_LOG DMESG
109
#define JD_WR_OVERHEAD 28
1110

1211
#define JD_CLIENT 1
1312

13+
#ifndef __XTENSA__
1414

15-
#if defined(CONFIG_IDF_TARGET_ESP32C3)
15+
// ESP32-C3
1616

1717
#define LED_R_MULT 250
1818
#define LED_G_MULT 250
@@ -39,6 +39,8 @@
3939

4040
#else
4141

42+
// ESP32-S2
43+
4244
#define LED_R_MULT 250
4345
#define LED_G_MULT 60
4446
#define LED_B_MULT 150
@@ -73,4 +75,6 @@
7375
void jdesp_wake_main(void);
7476
#define JD_WAKE_MAIN() jdesp_wake_main()
7577

78+
#define JD_SIMPLE_ALLOC 0
79+
7680
#endif

main/platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ int jd_pin_num(void) {
88
return PIN_JACDAC;
99
}
1010

11-
uint64_t jd_device_id(void) {
11+
uint64_t hw_device_id(void) {
1212
static uint64_t addr;
1313
if (!addr) {
1414
uint8_t mac[6];

0 commit comments

Comments
 (0)