mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
19697: drivers/sx127x: reduce use of floats r=benpicco a=maribu ### Contribution description Convert the floating point arithmetic to integer arithmetic. 19725: buildsystem: add target debug-client r=benpicco a=fabian18 Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net> Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com>
This commit is contained in:
commit
5e7c6c2ff7
@ -895,6 +895,10 @@ debug: $(DEBUGDEPS)
|
||||
$(call check_cmd,$(DEBUGGER),Debug program)
|
||||
$(DEBUGGER) $(DEBUGGER_FLAGS)
|
||||
|
||||
debug-client:
|
||||
$(call check_cmd,$(DEBUGCLIENT),Debug client program)
|
||||
$(DEBUGCLIENT) $(DEBUGCLIENT_FLAGS)
|
||||
|
||||
debug-server:
|
||||
$(call check_cmd,$(DEBUGSERVER),Debug server program)
|
||||
$(DEBUGSERVER) $(DEBUGSERVER_FLAGS)
|
||||
|
1
dist/tools/buildsystem_sanity_check/check.sh
vendored
1
dist/tools/buildsystem_sanity_check/check.sh
vendored
@ -107,6 +107,7 @@ UNEXPORTED_VARIABLES+=('FLASHER' 'FFLAGS')
|
||||
UNEXPORTED_VARIABLES+=('RESET' 'RESETFLAGS')
|
||||
UNEXPORTED_VARIABLES+=('DEBUGGER' 'DEBUGGER_FLAGS')
|
||||
UNEXPORTED_VARIABLES+=('DEBUGSERVER' 'DEBUGSERVER_FLAGS')
|
||||
UNEXPORTED_VARIABLES+=('DEBUGCLIENT' 'DEBUGCLIENT_FLAGS')
|
||||
UNEXPORTED_VARIABLES+=('PREFLASHER' 'PREFFLAGS' 'FLASHDEPS')
|
||||
UNEXPORTED_VARIABLES+=('OPENOCD_DEBUG_ADAPTER' 'DEBUG_ADAPTER_ID')
|
||||
UNEXPORTED_VARIABLES+=('PROGRAMMER_SERIAL')
|
||||
|
35
dist/tools/openocd/openocd.sh
vendored
35
dist/tools/openocd/openocd.sh
vendored
@ -50,6 +50,11 @@
|
||||
# TELNET_PORT: port opened for telnet connections
|
||||
# DBG: debugger client command, default: 'gdb -q'
|
||||
# TUI: if TUI!=null, the -tui option will be used
|
||||
# debug-client: debug-client <elffile>
|
||||
# connects to a running debug-server
|
||||
# GDB_PORT: port opened for GDB connections
|
||||
# DBG: debugger client command, default: 'gdb -q'
|
||||
# TUI: if TUI!=null, the -tui option will be used
|
||||
#
|
||||
# debugr: debug <elfile>
|
||||
# debug given file on the target but flash it first directly
|
||||
@ -349,6 +354,21 @@ do_flash() {
|
||||
echo 'Done flashing'
|
||||
}
|
||||
|
||||
do_debugclient() {
|
||||
ELFFILE=$1
|
||||
test_elffile
|
||||
# Export to be able to access these from the sh -c command lines, may be
|
||||
# useful when using a frontend for GDB
|
||||
export ELFFILE
|
||||
export GDB
|
||||
export GDB_PORT
|
||||
export DBG_FLAGS
|
||||
export DBG_DEFAULT_FLAGS
|
||||
export DBG_EXTRA_FLAGS
|
||||
# Start the debugger and connect to the GDB server
|
||||
sh -c "${DBG} ${DBG_FLAGS} ${ELFFILE}"
|
||||
}
|
||||
|
||||
do_debug() {
|
||||
ELFFILE=$1
|
||||
test_config
|
||||
@ -380,16 +400,7 @@ do_debug() {
|
||||
${OPENOCD_DBG_START_CMD} \
|
||||
-l /dev/null & \
|
||||
echo \$! > $OCD_PIDFILE" &
|
||||
# Export to be able to access these from the sh -c command lines, may be
|
||||
# useful when using a frontend for GDB
|
||||
export ELFFILE
|
||||
export GDB
|
||||
export GDB_PORT
|
||||
export DBG_FLAGS
|
||||
export DBG_DEFAULT_FLAGS
|
||||
export DBG_EXTRA_FLAGS
|
||||
# Start the debugger and connect to the GDB server
|
||||
sh -c "${DBG} ${DBG_FLAGS} ${ELFFILE}"
|
||||
do_debugclient ${ELFFILE}
|
||||
}
|
||||
|
||||
do_debugserver() {
|
||||
@ -490,6 +501,10 @@ case "${ACTION}" in
|
||||
echo "### Starting Debugging ###"
|
||||
do_debug "$@"
|
||||
;;
|
||||
debug-client)
|
||||
echo "### Attaching to GDB Server ###"
|
||||
do_debugclient "$@"
|
||||
;;
|
||||
debug-server)
|
||||
echo "### Starting GDB Server ###"
|
||||
do_debugserver
|
||||
|
@ -117,9 +117,10 @@ void sx127x_set_syncword(sx127x_t *dev, uint8_t syncword)
|
||||
|
||||
uint32_t sx127x_get_channel(const sx127x_t *dev)
|
||||
{
|
||||
return (((uint32_t)sx127x_reg_read(dev, SX127X_REG_FRFMSB) << 16) |
|
||||
(sx127x_reg_read(dev, SX127X_REG_FRFMID) << 8) |
|
||||
(sx127x_reg_read(dev, SX127X_REG_FRFLSB))) * LORA_FREQUENCY_RESOLUTION_DEFAULT;
|
||||
uint32_t raw = ((uint32_t)sx127x_reg_read(dev, SX127X_REG_FRFMSB) << 16)
|
||||
| ((uint32_t)sx127x_reg_read(dev, SX127X_REG_FRFMID) << 8)
|
||||
| ((uint32_t)sx127x_reg_read(dev, SX127X_REG_FRFLSB));
|
||||
return (uint64_t)raw * LORA_FREQUENCY_RESOLUTION_NANOHERTZ_DEFAULT / 1000000000U;
|
||||
}
|
||||
|
||||
void sx127x_set_channel(sx127x_t *dev, uint32_t channel)
|
||||
@ -129,7 +130,7 @@ void sx127x_set_channel(sx127x_t *dev, uint32_t channel)
|
||||
/* Save current operating mode */
|
||||
dev->settings.channel = channel;
|
||||
|
||||
channel = (uint32_t)((double)channel / (double)LORA_FREQUENCY_RESOLUTION_DEFAULT);
|
||||
channel = (uint64_t)channel * 1000000000U / LORA_FREQUENCY_RESOLUTION_NANOHERTZ_DEFAULT;
|
||||
|
||||
/* Write frequency settings into chip */
|
||||
sx127x_reg_write(dev, SX127X_REG_FRFMSB, (uint8_t)((channel >> 16) & 0xFF));
|
||||
|
@ -120,11 +120,10 @@ void sx1276_rx_chain_calibration(sx127x_t *dev)
|
||||
|
||||
/* Save context */
|
||||
reg_pa_config_init_val = sx127x_reg_read(dev, SX127X_REG_PACONFIG);
|
||||
initial_freq = (double)(((uint32_t)sx127x_reg_read(dev, SX127X_REG_FRFMSB) << 16)
|
||||
| ((uint32_t)sx127x_reg_read(dev, SX127X_REG_FRFMID) << 8)
|
||||
| ((uint32_t)sx127x_reg_read(dev,
|
||||
SX127X_REG_FRFLSB))) *
|
||||
(double)LORA_FREQUENCY_RESOLUTION_DEFAULT;
|
||||
initial_freq = ((uint32_t)sx127x_reg_read(dev, SX127X_REG_FRFMSB) << 16)
|
||||
| ((uint32_t)sx127x_reg_read(dev, SX127X_REG_FRFMID) << 8)
|
||||
| ((uint32_t)sx127x_reg_read(dev, SX127X_REG_FRFLSB));
|
||||
initial_freq = (uint64_t)initial_freq * LORA_FREQUENCY_RESOLUTION_NANOHERTZ_DEFAULT / 1000000000U;
|
||||
|
||||
/* Cut the PA just in case, RFO output, power = -1 dBm */
|
||||
sx127x_reg_write(dev, SX127X_REG_PACONFIG, 0x00);
|
||||
|
@ -119,6 +119,9 @@ info-build:
|
||||
@echo 'DEBUGSERVER: $(DEBUGSERVER)'
|
||||
@echo 'DEBUGSERVER_FLAGS: $(DEBUGSERVER_FLAGS)'
|
||||
@echo ''
|
||||
@echo 'DEBUGCLIENT: $(DEBUGCLIENT)'
|
||||
@echo 'DEBUGCLIENT_FLAGS: $(DEBUGCLIENT_FLAGS)'
|
||||
@echo ''
|
||||
@echo 'RESET: $(RESET)'
|
||||
@echo 'RESET_FLAGS: $(RESET_FLAGS)'
|
||||
@echo ''
|
||||
|
@ -1,12 +1,14 @@
|
||||
FLASHER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||
DEBUGGER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||
DEBUGSERVER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||
DEBUGCLIENT ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||
RESET ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||
|
||||
FLASHFILE ?= $(ELFFILE)
|
||||
FFLAGS ?= flash $(FLASHFILE)
|
||||
DEBUGGER_FLAGS ?= debug $(DEBUG_ELFFILE)
|
||||
DEBUGSERVER_FLAGS ?= debug-server
|
||||
DEBUGCLIENT_FLAGS ?= debug-client $(DEBUG_ELFFILE)
|
||||
RESET_FLAGS ?= reset
|
||||
|
||||
ifneq (,$(OPENOCD_DEBUG_ADAPTER))
|
||||
@ -44,7 +46,7 @@ ifneq (,$(OPENOCD_CMD_RESET_HALT))
|
||||
$(call target-export-variables,flash-only,OPENOCD_CMD_RESET_HALT)
|
||||
endif
|
||||
|
||||
OPENOCD_DEBUG_TARGETS = debug debugr debug-server
|
||||
OPENOCD_DEBUG_TARGETS = debug debugr debug-server debug-client
|
||||
|
||||
ifneq (,$(OPENOCD_DBG_EXTRA_CMD))
|
||||
# Export OPENOCD_DBG_EXTRA_CMD only to the flash/flash-only target
|
||||
|
@ -110,6 +110,8 @@ export HEXFILE # The 'intel hex' stripped result of the compilatio
|
||||
# DEBUGGER_FLAGS # The parameters to supply to DEBUGGER.
|
||||
# DEBUGSERVER # The command to call on "make debug-server", usually a script starting the GDB server.
|
||||
# DEBUGSERVER_FLAGS # The parameters to supply to DEBUGSERVER.
|
||||
# DEBUGCLIENT # The command to call on "make debug-client", usually a script starting the GDB client.
|
||||
# DEBUGCLIENT_FLAGS # The parameters to supply to DEBUGCLIENT.
|
||||
# DEVELHELP # Set to 1 to spend ROM, RAM and CPU time for help during development (e.g. enable asserts())
|
||||
# RESET # The command to call on "make reset", this command resets/reboots the target.
|
||||
# RESET_FLAGS # The parameters to supply to RESET.
|
||||
|
@ -35,9 +35,13 @@ extern "C" {
|
||||
* @ingroup config
|
||||
* @{
|
||||
*/
|
||||
/** @brief Frequency resolution in Hz */
|
||||
#ifndef LORA_FREQUENCY_RESOLUTION_DEFAULT
|
||||
#define LORA_FREQUENCY_RESOLUTION_DEFAULT (61.03515625)
|
||||
#ifndef LORA_FREQUENCY_RESOLUTION_NANOHERTZ_DEFAULT
|
||||
/**
|
||||
* @brief Frequency resolution in nano Hz
|
||||
*
|
||||
* This is the same as `(32 * 10^15) >> 19`
|
||||
*/
|
||||
#define LORA_FREQUENCY_RESOLUTION_NANOHERTZ_DEFAULT 61035156250
|
||||
#endif
|
||||
|
||||
/** @brief Preamble length, same for Tx and Rx
|
||||
|
Loading…
Reference in New Issue
Block a user