refactoring step 3 - components

squeezelite is a component
platform_esp32 is the main
This commit is contained in:
philippe44
2019-06-29 13:16:46 -07:00
parent 4b54f1733b
commit 53b0ab2390
49 changed files with 98 additions and 42 deletions

3
.gitignore vendored
View File

@@ -64,6 +64,5 @@ $RECYCLE.BIN/
libs/
/cdump.cmd
/_codecs
/_*
sdkconfig
/tmp

View File

@@ -1,6 +1,6 @@
set(COMPONENT_ADD_INCLUDEDIRS . )
set(COMPONENT_SRCS "esp_app_main.c" "platform_esp32.c" "bt_app_core.c" "cmd_wifi.c" "console.c" "nvs_utilities.c" "cmd_squeezelite.c")
set(COMPONENT_SRCS "bt_app_core.c" )
set(REQUIRES esp_common)
set(REQUIRES_COMPONENTS freertos nvs_flash esp32 spi_flash newlib log console )

View File

@@ -17,8 +17,7 @@
#include "argtable3/argtable3.h"
#include "bt_app_core.h"
#include "platform_esp32.h"
#include "trace.h"
static const char * TAG = "platform";

View File

@@ -6,4 +6,6 @@
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the SDK documents if you need to do this.
#
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
CFLAGS += -I$(COMPONENT_PATH)/../tools
#CFLAGS += -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG

View File

@@ -0,0 +1,18 @@
#
# "main" pseudo-component makefile.
#
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
CFLAGS += -O3 -DLINKALL -DLOOPBACK -DNO_FAAD -DRESAMPLE16 -DEMBEDDED -DTREMOR_ONLY -DBYTES_PER_FRAME=4 \
-I$(COMPONENT_PATH)/../codecs/inc \
-I$(COMPONENT_PATH)/../codecs/inc/mad \
-I$(COMPONENT_PATH)/../codecs/inc/alac \
-I$(COMPONENT_PATH)/../codecs/inc/helix-aac \
-I$(COMPONENT_PATH)/../codecs/inc/vorbis \
-I$(COMPONENT_PATH)/../codecs/inc/soxr \
-I$(COMPONENT_PATH)/../codecs/inc/resample16 \
-I$(COMPONENT_PATH)/../tools
# -I$(COMPONENT_PATH)/../codecs/inc/faad2

View File

@@ -287,10 +287,10 @@
#include <sys/types.h>
#endif /* SUN */
#define STREAM_THREAD_STACK_SIZE 64 * 1024
#define DECODE_THREAD_STACK_SIZE 128 * 1024
#define OUTPUT_THREAD_STACK_SIZE 64 * 1024
#define IR_THREAD_STACK_SIZE 64 * 1024
#define STREAM_THREAD_STACK_SIZE 8 * 1024
#define DECODE_THREAD_STACK_SIZE 20 * 1024
#define OUTPUT_THREAD_STACK_SIZE 8 * 1024
#define IR_THREAD_STACK_SIZE 8 * 1024
#if !OSX
#define thread_t pthread_t;
#endif

30
components/tools/trace.h Normal file
View File

@@ -0,0 +1,30 @@
/*
* Squeezelite for esp32
*
* (c) Sebastien 2019
* Philippe G. 2019, philippe_44@outlook.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifndef QUOTE
#define QUOTE(name) #name
#endif
#define ESP_LOG_DEBUG_EVENT(tag,e) ESP_LOGD(tag,"evt: " e)

7
main/CMakeLists.txt Normal file
View File

@@ -0,0 +1,7 @@
set(COMPONENT_ADD_INCLUDEDIRS . )
set(COMPONENT_SRCS "esp_app_main.c" "platform_esp32.c" "cmd_wifi.c" "console.c" "nvs_utilities.c" "cmd_squeezelite.c")
set(REQUIRES esp_common)
set(REQUIRES_COMPONENTS freertos nvs_flash esp32 spi_flash newlib log console )
register_component()

24
main/Params.txt Normal file
View File

@@ -0,0 +1,24 @@
LWIP
Enable Copy between L2 and L3 no (no)
Default receive window size 32768 (5740)
Default transmit window size 8192 (5740)
TCP:Default TCP receive mail box size 32 (6)
WiFi
Max number of WiFi static RX buffer 12-16 (6)
Max number of WiFi dynamic buffer 24-64 (16 or 10)
Max number of WiFi static TX buffer 12-16 (6)
SPI RAM
Maximum malloc() to always put in internal memory 512 (2048)
MBED_TLS
Memory allocation strategy: external
Put .bss in SPIRAM?
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"44100-44100\" -e flac"
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"44100-44100\""
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -R -u m -Z 192000 -r \"44100-44100\" -s 192.168.2.144"
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -r \"44100-44100\" -e flac"
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"44100-44100\""

View File

@@ -1,20 +1,10 @@
#
# "main" pseudo-component makefile.
# Component Makefile
#
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
CFLAGS += -O3 -DLINKALL -DLOOPBACK -DNO_FAAD -DRESAMPLE16 -DEMBEDDED -DTREMOR_ONLY -DBYTES_PER_FRAME=4 \
-I$(COMPONENT_PATH)/../components/codecs/inc \
-I$(COMPONENT_PATH)/../components/codecs/inc/mad \
-I$(COMPONENT_PATH)/../components/codecs/inc/alac \
-I$(COMPONENT_PATH)/../components/codecs/inc/helix-aac \
-I$(COMPONENT_PATH)/../components/codecs/inc/vorbis \
-I$(COMPONENT_PATH)/../components/codecs/inc/soxr \
-I$(COMPONENT_PATH)/../components/codecs/inc/resample16 \
-I$(COMPONENT_PATH)/../components/platform_esp32
# This Makefile should, at the very least, just include $(SDK_PATH)/Makefile. By default,
# this will take the sources in the src/ directory, compile them and link them into
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the SDK documents if you need to do this.
#
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
LDFLAGS += -s
# -I$(COMPONENT_PATH)/../components/codecs/inc/faad2

View File

@@ -22,6 +22,7 @@
#include "nvs_flash.h"
#include "pthread.h"
#include "platform_esp32.h"
#include "esp_pthread.h"
#include "cmd_decl.h"
#include "console.h"

View File

@@ -21,24 +21,10 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "esp_pthread.h"
#ifndef QUOTE
#define QUOTE(name) #name
#endif
#define ESP_LOG_DEBUG_EVENT(tag,e) ESP_LOGD(tag,"evt: " e)
extern void run_command(char * line);
extern bool wait_for_wifi();
extern void console_start();
extern pthread_cond_t wifi_connect_suspend_cond;
extern pthread_t wifi_connect_suspend_mutex;
#ifdef __cplusplus
}
#endif