]> code.bitgloo.com Git - bitgloo/dsp-paw.git/commitdiff
small fixes; add compile checks main
authorClyne Sullivan <clyne@bitgloo.com>
Tue, 10 Oct 2023 13:48:31 +0000 (09:48 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Tue, 10 Oct 2023 13:48:31 +0000 (09:48 -0400)
firmware/Makefile
firmware/source/communication.cpp
firmware/source/conversion.cpp
firmware/source/periph/usbcfg.c
firmware/source/samplebuffer.cpp
firmware/source/samplebuffer.hpp

index 0db249b357e28ceb1e6a36b89b8ea5e779ab3c2f..542bcea2afc2b85a9fb1c39891385223625fade5 100644 (file)
@@ -162,10 +162,10 @@ INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC) \
          source source/periph
 
 # Define C warning options here.
          source source/periph
 
 # Define C warning options here.
-CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -pedantic
+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -pedantic -Werror
 
 # Define C++ warning options here.
 
 # Define C++ warning options here.
-CPPWARN = -Wall -Wextra -Wundef -pedantic -Wno-volatile
+CPPWARN = -Wall -Wextra -Wundef -pedantic -Wno-volatile -Werror -Wconversion
 
 #
 # Project, target, sources and paths
 
 #
 # Project, target, sources and paths
@@ -217,6 +217,17 @@ include $(RULESPATH)/rules.mk
 # Custom rules
 #
 
 # Custom rules
 #
 
+check:
+       cppcheck --std=c++17 --enable=warning,style,performance,portability --force $(shell find source/ -name "*.cpp" -or -name "*.hpp" -or -name "*.c" -or -name "*.h" -type f)
+
+tidy:
+       clang-tidy \
+               -warnings-as-errors=* \
+               --extra-arg=-I --extra-arg=/usr/lib/gcc/arm-none-eabi/13/include/g++-v13 \
+               --extra-arg=-I --extra-arg=/usr/lib/gcc/arm-none-eabi/13/include/g++-v13/arm-none-eabi \
+               $(CPPSRC)
+
 #
 # Custom rules
 ##############################################################################
 #
 # Custom rules
 ##############################################################################
+
index e85828bb8ce471607351863016dc0db78b919d14..8a9f86e5534aead3d1032ddcfd6e158043309b22 100644 (file)
@@ -223,7 +223,7 @@ void sampleRate(unsigned char *cmd)
 {
     if (EM.assert(USBSerial::read(&cmd[1], 1) == 1, Error::BadParamSize)) {
         if (cmd[1] == 0xFF) {
 {
     if (EM.assert(USBSerial::read(&cmd[1], 1) == 1, Error::BadParamSize)) {
         if (cmd[1] == 0xFF) {
-            unsigned char r = SClock::getRate();
+            auto r = static_cast<unsigned char>(SClock::getRate());
             USBSerial::write(&r, 1);
         } else {
             auto r = static_cast<SClock::Rate>(cmd[1]);
             USBSerial::write(&r, 1);
         } else {
             auto r = static_cast<SClock::Rate>(cmd[1]);
index 56a689eb22a6616c2256c75ac7f1df84895cc9bf..8b6a9277d448f1c7076a69913122ea98fc208983 100644 (file)
@@ -156,6 +156,7 @@ void ConversionManager::threadRunner(void *)
                     samples = entry(samples, size);
                     asm("mov sp, %0" :: "r" (sp));
                     volatile auto testRead = *samples;
                     samples = entry(samples, size);
                     asm("mov sp, %0" :: "r" (sp));
                     volatile auto testRead = *samples;
+                    (void)testRead;
                 } else {
                     // Start execution timer:
                     asm("mov %0, sp; eor r0, r0; svc 2" : "=r" (sp));
                 } else {
                     // Start execution timer:
                     asm("mov %0, sp; eor r0, r0; svc 2" : "=r" (sp));
@@ -163,6 +164,7 @@ void ConversionManager::threadRunner(void *)
                     // Stop execution timer:
                     asm("mov r0, #1; svc 2; mov sp, %0" :: "r" (sp));
                     volatile auto testRead = *samples;
                     // Stop execution timer:
                     asm("mov r0, #1; svc 2; mov sp, %0" :: "r" (sp));
                     volatile auto testRead = *samples;
+                    (void)testRead;
                 } 
             }
 
                 } 
             }
 
index b726e23a95b3db587455d3e8ade0de2c69266e63..537cca7082c43bc3792ae9e32fe0ffa405ab91b2 100644 (file)
@@ -264,7 +264,6 @@ static const USBEndpointConfig ep2config = {
  * Handles the USB driver global events.\r
  */\r
 static void usb_event(USBDriver *usbp, usbevent_t event) {\r
  * Handles the USB driver global events.\r
  */\r
 static void usb_event(USBDriver *usbp, usbevent_t event) {\r
-  extern SerialUSBDriver SDU1;\r
 \r
   switch (event) {\r
   case USB_EVENT_ADDRESS:\r
 \r
   switch (event) {\r
   case USB_EVENT_ADDRESS:\r
index 74c6778a287b4fbcf80f9cc613f1070b194570ac..f04173af9b13ccd905e9598954c546ac806f717d 100644 (file)
@@ -19,12 +19,12 @@ void SampleBuffer::clear() {
 }
 __attribute__((section(".convcode")))
 void SampleBuffer::modify(Sample *data, unsigned int srcsize) {
 }
 __attribute__((section(".convcode")))
 void SampleBuffer::modify(Sample *data, unsigned int srcsize) {
-    auto size = srcsize < m_size ? srcsize : m_size;
-    size = (size + 15) & (~15);
+    auto dsize = srcsize < m_size ? srcsize : m_size;
+    dsize = (dsize + 15) & (~15);
 
     m_modified = m_buffer;
     const int *src = reinterpret_cast<const int *>(data);
 
     m_modified = m_buffer;
     const int *src = reinterpret_cast<const int *>(data);
-    const int * const srcend = src + (size / 2);
+    const int * const srcend = src + (dsize / 2);
     int *dst = reinterpret_cast<int *>(m_buffer);
     do {
         int a = src[0];
     int *dst = reinterpret_cast<int *>(m_buffer);
     do {
         int a = src[0];
@@ -49,12 +49,12 @@ void SampleBuffer::modify(Sample *data, unsigned int srcsize) {
 }
 __attribute__((section(".convcode")))
 void SampleBuffer::midmodify(Sample *data, unsigned int srcsize) {
 }
 __attribute__((section(".convcode")))
 void SampleBuffer::midmodify(Sample *data, unsigned int srcsize) {
-    auto size = srcsize < m_size / 2 ? srcsize : m_size / 2;
-    size = (size + 15) & (~15);
+    auto dsize = srcsize < m_size / 2 ? srcsize : m_size / 2;
+    dsize = (dsize + 15) & (~15);
 
     m_modified = middata();
     const int *src = reinterpret_cast<const int *>(data);
 
     m_modified = middata();
     const int *src = reinterpret_cast<const int *>(data);
-    const int * const srcend = src + (size / 2);
+    const int * const srcend = src + (dsize / 2);
     int *dst = reinterpret_cast<int *>(middata());
     do {
         int a = src[0];
     int *dst = reinterpret_cast<int *>(middata());
     do {
         int a = src[0];
index 83287701e0c448ac3365b85fb45768c3983dd33d..9b837bc082442770dc6cec6dde6a783cc0d34c93 100644 (file)
@@ -29,7 +29,7 @@ class SampleBuffer
 {
 public:
     // Manage the sample data memory at 'buffer'.
 {
 public:
     // Manage the sample data memory at 'buffer'.
-    SampleBuffer(Sample *buffer);
+    explicit SampleBuffer(Sample *buffer);
 
     /**
      * Fill the current buffer with midpoint (2048/0V) values.
 
     /**
      * Fill the current buffer with midpoint (2048/0V) values.