Browse Source

Use FLASHMEM for functions, not attribute progmem

main
PaulStoffregen 5 years ago
parent
commit
0cfda40a56
6 changed files with 15 additions and 20 deletions
  1. +1
    -2
      teensy4/AudioStream.cpp
  2. +2
    -2
      teensy4/analog.c
  3. +4
    -6
      teensy4/debugprintf.c
  4. +4
    -6
      teensy4/startup.c
  5. +2
    -2
      teensy4/tempmon.c
  6. +2
    -2
      teensy4/usb.c

+ 1
- 2
teensy4/AudioStream.cpp View File

@@ -52,8 +52,7 @@ void software_isr(void);

// Set up the pool of audio data blocks
// placing them all onto the free list
__attribute__((section(".progmem")))
void AudioStream::initialize_memory(audio_block_t *data, unsigned int num)
FLASHMEM void AudioStream::initialize_memory(audio_block_t *data, unsigned int num)
{
unsigned int i;
unsigned int maxnum = MAX_AUDIO_MEMORY / AUDIO_BLOCK_SAMPLES / 2;

+ 2
- 2
teensy4/analog.c View File

@@ -1,6 +1,7 @@
#include "imxrt.h"
#include "core_pins.h"
#include "debug/printf.h"
#include "avr/pgmspace.h"

static uint8_t calibrating;
static uint8_t analog_config_bits = 10;
@@ -150,8 +151,7 @@ void analogReadAveraging(unsigned int num)

#define MAX_ADC_CLOCK 20000000

__attribute__((section(".progmem")))
void analog_init(void)
FLASHMEM void analog_init(void)
{
uint32_t mode, avg=0;


+ 4
- 6
teensy4/debugprintf.c View File

@@ -2,6 +2,7 @@

#ifdef PRINT_DEBUG_STUFF

#include "avr/pgmspace.h"
#include <stdarg.h>
#include "imxrt.h"

@@ -9,8 +10,7 @@ void putchar_debug(char c);
static void puint_debug(unsigned int num);


__attribute__((section(".progmem")))
void printf_debug(const char *format, ...)
FLASHMEM void printf_debug(const char *format, ...)
{
va_list args;
unsigned int val;
@@ -70,15 +70,13 @@ static void puint_debug(unsigned int num)
printf_debug(buf + i);
}

__attribute__((section(".progmem")))
void putchar_debug(char c)
FLASHMEM void putchar_debug(char c)
{
while (!(LPUART3_STAT & LPUART_STAT_TDRE)) ; // wait
LPUART3_DATA = c;
}

__attribute__((section(".progmem")))
void printf_debug_init(void)
FLASHMEM void printf_debug_init(void)
{
CCM_CCGR0 |= CCM_CCGR0_LPUART3(CCM_CCGR_ON); // turn on Serial4
IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_06 = 2; // Arduino pin 17

+ 4
- 6
teensy4/startup.c View File

@@ -1,6 +1,7 @@
#include "imxrt.h"
#include "wiring.h"
#include "usb_dev.h"
#include "avr/pgmspace.h"

#include "debug/printf.h"

@@ -191,8 +192,7 @@ static void configure_systick(void)
#define SIZE_64M (SCB_MPU_RASR_SIZE(25) | SCB_MPU_RASR_ENABLE)
#define REGION(n) (SCB_MPU_RBAR_REGION(n) | SCB_MPU_RBAR_VALID)

__attribute__((section(".progmem")))
void configure_cache(void)
FLASHMEM void configure_cache(void)
{
//printf("MPU_TYPE = %08lX\n", SCB_MPU_TYPE);
//printf("CCR = %08lX\n", SCB_CCR);
@@ -236,8 +236,7 @@ void configure_cache(void)
}


__attribute__((section(".progmem")))
void usb_pll_start()
FLASHMEM void usb_pll_start()
{
while (1) {
uint32_t n = CCM_ANALOG_PLL_USB1; // pg 759
@@ -281,8 +280,7 @@ void usb_pll_start()
}
}

__attribute__((section(".progmem")))
void reset_PFD()
FLASHMEM void reset_PFD()
{
//Reset PLL2 PFDs, set default frequencies:
CCM_ANALOG_PFD_528_SET = (1 << 31) | (1 << 23) | (1 << 15) | (1 << 7);

+ 2
- 2
teensy4/tempmon.c View File

@@ -1,5 +1,6 @@
#include "imxrt.h"
#include "core_pins.h"
#include "avr/pgmspace.h"
#include "debug/printf.h"


@@ -11,8 +12,7 @@ static uint32_t panicAlarmTemp = 90U;
static uint32_t s_hotTemp, s_hotCount, s_roomC_hotC;
static float s_hot_ROOM;

__attribute__((section(".progmem")))
void tempmon_init(void)
FLASHMEM void tempmon_init(void)
{
// Notes:
// TEMPMON_TEMPSENSE0 &= ~0x2U; Stops temp monitoring

+ 2
- 2
teensy4/usb.c View File

@@ -3,6 +3,7 @@
#include "usb_desc.h"
#include "usb_serial.h"
#include "core_pins.h" // for delay()
#include "avr/pgmspace.h"
#include <string.h>
#include "debug/printf.h"

@@ -97,8 +98,7 @@ static void endpoint0_complete(void);
static void run_callbacks(endpoint_t *ep);


__attribute__((section(".progmem")))
void usb_init(void)
FLASHMEM void usb_init(void)
{
// TODO: only enable when VBUS detected
// TODO: return to low power mode when VBUS removed

Loading…
Cancel
Save