###################################################
-CFLAGS = -std=gnu99 -g -Wall -Tstm32_flash.ld -DSTM32F4XX -DCORTEX_M4
+CFLAGS = -std=gnu99 -O3 -g -Wall -Tstm32_flash.ld -DSTM32F4XX -DCORTEX_M4
CFLAGS += -mlittle-endian -mthumb -mthumb-interwork -nostartfiles -mcpu=cortex-m4
ifeq ($(FLOAT_TYPE), hard)
###################################################
-all: libstm32f4.a codec2_profile.elf fft_test.elf dac_ut.elf dac_play.elf adc_rec.elf pwm_ut.elf fdmdv_profile.elf sm1000_leds_switches_ut.elf sm1000.elf adcdac_ut.elf freedv_profile.elf
+all: libstm32f4.a codec2_profile.elf fft_test.elf dac_ut.elf dac_play.elf adc_rec.elf pwm_ut.elf fdmdv_profile.elf sm1000_leds_switches_ut.elf sm1000.elf adcdac_ut.elf freedv_tx_profile.elf freedv_rx_profile.elf
dl/$(PERIPHLIBZIP):
mkdir -p dl
sm1000.elf: $(SM1000_SRCS) src/stm32f4_dac.o src/stm32f4_adc.o
$(CC) $(CFLAGS) -O3 $^ -o $@ $(LIBPATHS) $(LIBS)
-FREEDV_PROFILE_SRCS=\
-src/freedv_profile.c \
+FREEDV_TX_PROFILE_SRCS=\
+src/freedv_tx_profile.c \
src/stm32f4_machdep.c \
gdb_stdio.c \
src/system_stm32f4xx.c \
src/startup_stm32f4xx.s \
src/init.c
-FREEDV_PROFILE_SRCS += $(CODEC2_SRCS)
+FREEDV_TX_PROFILE_SRCS += $(CODEC2_SRCS)
-freedv_profile.elf: $(FREEDV_PROFILE_SRCS)
- $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS)
+freedv_tx_profile.elf: $(FREEDV_TX_PROFILE_SRCS)
+ $(CC) $(CFLAGS) -DPROFILE $^ -o $@ $(LIBPATHS) $(LIBS)
+
+FREEDV_RX_PROFILE_SRCS=\
+src/freedv_rx_profile.c \
+src/stm32f4_machdep.c \
+gdb_stdio.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+FREEDV_RX_PROFILE_SRCS += $(CODEC2_SRCS)
+
+freedv_rx_profile.elf: $(FREEDV_RX_PROFILE_SRCS)
+ $(CC) $(CFLAGS) -DPROFILE $^ -o $@ $(LIBPATHS) $(LIBS)
clean:
rm -f *.o
--- /dev/null
+/*---------------------------------------------------------------------------*\\r
+\r
+ FILE........: freedv_rx_profile.c\r
+ AUTHOR......: David Rowe\r
+ DATE CREATED: 13 August 2014\r
+\r
+ Profiling freedv_rx() operation on the STM32F4.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+ Copyright (C) 2014 David Rowe\r
+\r
+ All rights reserved.\r
+\r
+ This program is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU Lesser General Public License version 2.1, as\r
+ published by the Free Software Foundation. This program is\r
+ distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public\r
+ License for more details.\r
+\r
+ You should have received a copy of the GNU Lesser General Public License\r
+ along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <stdint.h>\r
+#include <math.h>\r
+\r
+#include "stm32f4xx_conf.h"\r
+#include "stm32f4xx.h"\r
+#include "gdb_stdio.h"\r
+#include "freedv_api.h"\r
+#include "machdep.h"\r
+\r
+#ifdef __EMBEDDED__\r
+#define printf gdb_stdio_printf\r
+#define fopen gdb_stdio_fopen\r
+#define fclose gdb_stdio_fclose\r
+#define fread gdb_stdio_fread\r
+#define fwrite gdb_stdio_fwrite\r
+#endif\r
+\r
+int main(int argc, char *argv[]) {\r
+ struct freedv *f;\r
+ short inbuf[FREEDV_NSAMPLES], outbuf[FREEDV_NSAMPLES];\r
+ FILE *fin, *fout;\r
+ int frame, nin, nout = 0;\r
+ PROFILE_VAR(freedv_start);\r
+\r
+ machdep_profile_init();\r
+\r
+ f = freedv_open(FREEDV_MODE_1600);\r
+\r
+ // Transmit ---------------------------------------------------------------------\r
+\r
+ frame = 0;\r
+\r
+ fin = fopen("mod.raw", "rb");\r
+ if (fin == NULL) {\r
+ printf("Error opening input file\n");\r
+ exit(1);\r
+ }\r
+\r
+ fout = fopen("stm_out.raw", "wb");\r
+ if (fout == NULL) {\r
+ printf("Error opening output file\n");\r
+ exit(1);\r
+ }\r
+\r
+ nin = freedv_nin(f);\r
+ while (fread(inbuf, sizeof(short), nin, fin) == nin) {\r
+ PROFILE_SAMPLE(freedv_start);\r
+ nout = freedv_rx(f, outbuf, inbuf);\r
+ nin = freedv_nin(f);\r
+ PROFILE_SAMPLE_AND_LOG2(freedv_start, " demod"); \r
+\r
+ machdep_profile_print_logged_samples();\r
+ fwrite(outbuf, sizeof(short), nout, fout);\r
+ printf("frame: %d\n", ++frame);\r
+ }\r
+\r
+ fclose(fin);\r
+ fclose(fout);\r
+\r
+ return 0;\r
+}\r
+\r
--- /dev/null
+/*---------------------------------------------------------------------------*\\r
+\r
+ FILE........: freedv_tx_profile.c\r
+ AUTHOR......: David Rowe\r
+ DATE CREATED: 13 August 2014\r
+\r
+ Profiling freedv_tx() operation on the STM32F4.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*\r
+ Copyright (C) 2014 David Rowe\r
+\r
+ All rights reserved.\r
+\r
+ This program is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU Lesser General Public License version 2.1, as\r
+ published by the Free Software Foundation. This program is\r
+ distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public\r
+ License for more details.\r
+\r
+ You should have received a copy of the GNU Lesser General Public License\r
+ along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <stdint.h>\r
+#include <math.h>\r
+\r
+#include "stm32f4xx_conf.h"\r
+#include "stm32f4xx.h"\r
+#include "gdb_stdio.h"\r
+#include "freedv_api.h"\r
+#include "machdep.h"\r
+\r
+#ifdef __EMBEDDED__\r
+#define printf gdb_stdio_printf\r
+#define fopen gdb_stdio_fopen\r
+#define fclose gdb_stdio_fclose\r
+#define fread gdb_stdio_fread\r
+#define fwrite gdb_stdio_fwrite\r
+#endif\r
+\r
+int main(int argc, char *argv[]) {\r
+ struct freedv *f;\r
+ short inbuf[FREEDV_NSAMPLES], outbuf[FREEDV_NSAMPLES];\r
+ FILE *fin, *fout;\r
+ int frame;\r
+ PROFILE_VAR(freedv_start);\r
+\r
+ machdep_profile_init();\r
+\r
+ f = freedv_open(FREEDV_MODE_1600);\r
+\r
+ // Transmit ---------------------------------------------------------------------\r
+\r
+ fin = fopen("stm_in.raw", "rb");\r
+ if (fin == NULL) {\r
+ printf("Error opening input file\n");\r
+ exit(1);\r
+ }\r
+\r
+ fout = fopen("mod.raw", "wb");\r
+ if (fout == NULL) {\r
+ printf("Error opening output file\n");\r
+ exit(1);\r
+ }\r
+\r
+ frame = 0;\r
+\r
+ while (fread(inbuf, sizeof(short), FREEDV_NSAMPLES, fin) == FREEDV_NSAMPLES) {\r
+ PROFILE_SAMPLE(freedv_start);\r
+ freedv_tx(f, outbuf, inbuf);\r
+ PROFILE_SAMPLE_AND_LOG2(freedv_start, " freedv_tx"); \r
+ \r
+ fwrite(outbuf, sizeof(short), FREEDV_NSAMPLES, fout);\r
+ printf("frame: %d\n", ++frame);\r
+ machdep_profile_print_logged_samples();\r
+ }\r
+\r
+ fclose(fin);\r
+ fclose(fout);\r
+\r
+ return 0;\r
+}\r
+\r
nout = freedv_rx(f, buf, buf);\r
dac2_write(buf, nout);\r
led_ptt(0); led_rt(f->fdmdv_stats.sync); led_err(f->total_bit_errors);\r
+ nin = freedv_nin(f);\r
}\r
\r
}\r