Skip to content

Commit

Permalink
Cleanups, minor fixes/updates
Browse files Browse the repository at this point in the history
* Removed some unused/noisy debug messages
* Declare global variables as static when suitable
* Replace more <xxx.h> with <cxxx>
* plat-msp430: raise instead of toggle the counter GPIO signal, so that
  detection is more reliable
  • Loading branch information
Chih-Hsuan Yen committed Oct 10, 2021
1 parent e458d95 commit eadb951
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions common/plat-linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

/* data on NVM, made persistent via mmap() with a file */
uint8_t *nvm;
uint32_t shutdown_counter = UINT32_MAX;
static uint32_t shutdown_counter = UINT32_MAX;
static uint64_t nvm_writes = 0;

Counters *counters() {
Expand Down Expand Up @@ -127,7 +127,6 @@ void my_memcpy_ex(void* dest, const void* src, size_t n, uint8_t write_to_nvm) {
Model* model = &model_vm;
counters()->dma_invocations[model->layer_idx]++;
counters()->dma_bytes[model->layer_idx] += n;
// my_printf_debug("%s copied %zu bytes" NEWLINE, __func__, n);
// Not using memcpy here so that it is more likely that power fails during
// memcpy, which is the case for external FRAM
uint8_t *dest_u = reinterpret_cast<uint8_t*>(dest);
Expand Down
4 changes: 1 addition & 3 deletions common/plat-msp430.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#elif defined(__MSP432__)
#include <msp432.h>
#endif
#include <stdint.h>
#include <cstdint>
#include <string.h>
#include "intermittent-cnn.h"
#include "cnn_common.h"
Expand Down Expand Up @@ -109,7 +109,6 @@ void read_from_nvm(void* vm_buffer, uint32_t nvm_offset, size_t n) {
SPI_ADDR addr;
addr.L = nvm_offset;
SPI_READ(&addr, reinterpret_cast<uint8_t*>(vm_buffer), n);
my_printf_debug("%d words read from NVM offset %d" NEWLINE, n, nvm_offset);
}

void write_to_nvm(const void* vm_buffer, uint32_t nvm_offset, size_t n, uint16_t timer_delay) {
Expand All @@ -118,7 +117,6 @@ void write_to_nvm(const void* vm_buffer, uint32_t nvm_offset, size_t n, uint16_t
check_nvm_write_address(nvm_offset, n);
MY_ASSERT(n <= 1024);
SPI_WRITE2(&addr, reinterpret_cast<const uint8_t*>(vm_buffer), n, timer_delay);
my_printf_debug("%d words written to NVM offset %d" NEWLINE, n, nvm_offset);
}

uint64_t get_nvm_writes(void) {
Expand Down

0 comments on commit eadb951

Please sign in to comment.