質問編集履歴
2
問題の原因がマイコンにあったため、マイコンの種類を追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,6 +14,10 @@
|
|
14
14
|
math.hのcos関数に変数を代入して計算させると戻り値が常に0.00になってしまい、目的の計算プログラムが機能しなくなり困っています。
|
15
15
|
cos(-4.96)が0.25を返しているのでcos関数自体は機能しているはずですし、Serial.print(angle_rad)でまともな数字を表示していますし、さっぱり何が原因であるのかがわかりません。
|
16
16
|
|
17
|
+
###動作環境
|
18
|
+
マイコンボード:GR-Citrus
|
19
|
+
開発環境:IDE for GR v1.13
|
20
|
+
|
17
21
|
### 発生している問題・エラーメッセージ
|
18
22
|
コンパイルエラーなどは出ませんでした。
|
19
23
|
|
1
コンパイラオプションを載せました
title
CHANGED
File without changes
|
body
CHANGED
@@ -24,4 +24,82 @@
|
|
24
24
|
// (中略 変数angle_radへの代入はない)
|
25
25
|
Serial.print(angle_rad); // -4.96と表示
|
26
26
|
Serial.print(cos(angle_rad)); // 0.25と表示(合っている)
|
27
|
+
```
|
28
|
+
|
29
|
+
### おそらくコンパイルオプション
|
30
|
+
|
31
|
+
|
32
|
+
```platform.txt
|
33
|
+
# RX63N and platform.
|
34
|
+
# ------------------------------
|
35
|
+
|
36
|
+
# For more info:
|
37
|
+
|
38
|
+
name=Renesas RX63
|
39
|
+
#version=2.2.0
|
40
|
+
|
41
|
+
# AVR compile variables
|
42
|
+
# ---------------------
|
43
|
+
|
44
|
+
# Default "compiler.path" is correct, change only if you want to overidde the initial value
|
45
|
+
compiler.path={runtime.ide.path}/hardware/tools/gcc-rx/rx-elf/rx-elf/bin/
|
46
|
+
compiler.ar.path = {runtime.ide.path}/hardware/arduino/rx63/cores/
|
47
|
+
compiler.c.cmd=rx-elf-gcc
|
48
|
+
compiler.c.flags=-Wall -ffunction-sections -fno-function-cse -fsigned-char -fdata-sections -mno-balign -DARDUINO=100 -DCPPAPP -D__RX_LITTLE_ENDIAN__=1 -D__T4__ -O2 -flto -mlittle-endian-data -mcpu=rx600 -Ihardware/arduino/rx63/cores/ -Ihardware/arduino/rx63/cores/core -Ihardware/arduino/rx63/cores/core/avr -Ihardware/arduino/rx63/cores/lib -Ihardware/arduino/rx63/libraries/DSP -Ihardware/arduino/rx63/libraries/DSP/utility -Ihardware/arduino/rx63/libraries/EEPROM -Ihardware/arduino/rx63/libraries/EEPROM/utility -Ihardware/arduino/rx63/libraries/Ethernet -Ihardware/arduino/rx63/libraries/Ethernet/utility -Ihardware/arduino/rx63/libraries/Ethernet/utility/driver -Ihardware/arduino/rx63/libraries/Ethernet/utility/r_byteq_v1.30 -Ihardware/arduino/rx63/libraries/Ethernet/utility/r_config -Ihardware/arduino/rx63/libraries/Ethernet/utility/T4_src -Ihardware/arduino/rx63/libraries/Ethernet/utility/T4_src/checksum -Ihardware/arduino/rx63/libraries/Ethernet/utility/T4_src/checksum/rx -Ihardware/arduino/rx63/libraries/Firmata -Ihardware/arduino/rx63/libraries/LiquidCrystal -Ihardware/arduino/rx63/libraries/MsTimer2 -Ihardware/arduino/rx63/libraries/RTC -Ihardware/arduino/rx63/libraries/RTC/utility -Ihardware/arduino/rx63/libraries/SD -Ihardware/arduino/rx63/libraries/SD/utility -Ihardware/arduino/rx63/libraries/Servo -Ihardware/arduino/rx63/libraries/SoftwareSerial -Ihardware/arduino/rx63/libraries/SPI -Ihardware/arduino/rx63/libraries/Stepper -Ihardware/arduino/rx63/libraries/Wire -Ihardware/arduino/rx63/libraries/Wire/utility -Ihardware/arduino/rx63/cores/rx63n -Ihardware/arduino/rx63/libraries/ArduinoJson -Ihardware/arduino/rx63/libraries/postParser -Ihardware/arduino/rx63/libraries/PubSubClient -Ihardware/arduino/rx63/libraries/WavMp3p -Ihardware/arduino/rx63/libraries/WavMp3p/utility -Ihardware/arduino/rx63/libraries/WiFiEsp -Ihardware/arduino/rx63/libraries/WiFiEsp/utility -Ihardware/arduino/rx63/libraries/AdafruitGFX
|
49
|
+
compiler.S.cmd=rx-elf-gcc
|
50
|
+
compiler.S.flags= -ffunction-sections -fno-function-cse -fsigned-char -fdata-sections -mno-balign -DARDUINO=100 -DCPPAPP -D__RX_LITTLE_ENDIAN__=1 -D__T4__ -O2 -mlittle-endian-data -mcpu=rx600
|
51
|
+
compiler.elf2hex.flags=-O binary
|
52
|
+
#compiler.elf2hex.flags=-O srec
|
53
|
+
compiler.elf2hex.cmd=rx-elf-objcopy
|
54
|
+
compiler.c.elf.cmd=rx-elf-ld
|
55
|
+
compiler.c.elf.flags=
|
56
|
+
compiler.ar.cmd=rx-elf-ar
|
57
|
+
compiler.ar.flags=rcs
|
58
|
+
compiler.ld.flags= -e_PowerON_Reset -no-keep-memory -S
|
59
|
+
compiler.size.cmd=rx-elf-size
|
60
|
+
# this can be overriden in boards.txt
|
61
|
+
build.extra_flags=
|
62
|
+
|
63
|
+
# AVR compile patterns
|
64
|
+
# --------------------
|
65
|
+
|
66
|
+
## Compile c files
|
67
|
+
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" -std=gnu99 {includes} {compiler.c.flags} {build.extra_flags} -c -x c "{source_file}" -o "{object_file}"
|
68
|
+
|
69
|
+
## Compile c++ files
|
70
|
+
recipe.cpp.o.pattern="{compiler.path}{compiler.c.cmd}" -std=gnu++11 {includes} {compiler.c.flags} {build.extra_flags} -c -x c++ "{source_file}" -o "{object_file}"
|
71
|
+
|
72
|
+
## Compile S files
|
73
|
+
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {includes} {compiler.S.flags} -c -x assembler-with-cpp "{source_file}" -o "{object_file}"
|
74
|
+
|
75
|
+
## Create archives
|
76
|
+
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
77
|
+
|
78
|
+
## for rapid compile
|
79
|
+
## Combine gc-sections, archives, and objects
|
80
|
+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.ld.flags} "-T{build.variant.path}/{build.ldscript}" {object_files} --whole-archive "{build.variant.path}/gr_common.a" --no-whole-archive "-L{build.path}" "{build.path}/{archive_file}" -o "{build.path}/{build.project_name}.elf" "-L{runtime.ide.path}/hardware/tools/gcc-rx/rx-elf/rx-elf/rx-elf/lib/64-bit-double" "-L{runtime.ide.path}/hardware/tools/gcc-rx/rx-elf/rx-elf/lib/gcc/rx-elf/4.8.4.201801-GNURX/64-bit-double" --no-flag-mismatch-warnings --start-group -lstdc++ -lnosys -lsim -lm -lc -lgcc --end-group
|
81
|
+
|
82
|
+
## Create eeprom
|
83
|
+
recipe.objcopy.eep.pattern=
|
84
|
+
|
85
|
+
## Create hex
|
86
|
+
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
|
87
|
+
|
88
|
+
## Compute size
|
89
|
+
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
|
90
|
+
recipe.size.regex=^(?:.text|.data|.bootloader)\s+([0-9]+).*
|
91
|
+
recipe.size.regex.data=^(?:.data|.bss|.noinit)\s+([0-9]+).*
|
92
|
+
recipe.size.regex.eeprom=^(?:.eeprom)\s+([0-9]+).*
|
93
|
+
|
94
|
+
|
95
|
+
# SAM3 Uploader tools
|
96
|
+
# -------------------
|
97
|
+
|
98
|
+
tools.savesketch.cmd=SaveSketch
|
99
|
+
tools.savesketch.cmd.windows=SaveSketch.bat
|
100
|
+
tools.savesketch.path={runtime.ide.path}/hardware/tools/rx
|
101
|
+
|
102
|
+
tools.savesketch.upload.params.verbose=
|
103
|
+
tools.savesketch.upload.params.quiet=
|
104
|
+
tools.savesketch.upload.pattern="{path}/{cmd}" "{name}" "{build.path}\{build.project_name}.bin"
|
27
105
|
```
|