Skip to content

Commit 9525bf0

Browse files
authored
Merge pull request #1 from dinau/mod
mod: README.md
2 parents 90d8d48 + b6a97f5 commit 9525bf0

File tree

2 files changed

+79
-88
lines changed

2 files changed

+79
-88
lines changed

README.html

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
<li><a href="#user-content-nim-compiler">Nim compiler</a></li>
6868
<li><a href="#user-content-c-compiler-arm-none-eabi-gcc">C compiler: arm-none-eabi-gcc</a></li>
6969
<li><a href="#user-content-compiling-source-code">Compiling source code</a></li>
70-
<li><a href="#user-content-generated-files-are">Generated files are</a></li>
7170
<li><a href="#user-content-output-music-filename--through-uart-port">Output music filename through UART port</a></li>
7271
<li><a href="#user-content-simple-less-bits-mode">Simple less bits mode</a></li>
7372
<li><a href="#user-content-pursue-small-code-size">Pursue small code size</a></li>
@@ -117,8 +116,6 @@ <h4>
117116
<a id="user-content-supported-pcm-format" class="anchor" href="#supported-pcm-format" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Supported PCM Format</h4>
118117
<ul>
119118
<li>PCM wav file that have file extension ".wav" on root directory.</li>
120-
</ul>
121-
<ul>
122119
<li>16bit/8bit, fs(sampling rate)=32kHz,44.1kHz,48kHz.</li>
123120
<li>Stereo/Mono.</li>
124121
</ul>
@@ -142,8 +139,6 @@ <h4>
142139
<a id="user-content-hardware-settingschematic-16bit-sound-resolution" class="anchor" href="#hardware-settingschematic-16bit-sound-resolution" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Hardware setting/Schematic: (16bit sound resolution)</h4>
143140
<ul>
144141
<li>Refer to the file, <a href="https://github.com/dinau/stm32-wave-player-pwm-super-lite-nim/blob/main/port_setting.md">port_setting.md</a>.</li>
145-
</ul>
146-
<ul>
147142
<li>See folder doc/*<br>
148143
<p><img src="http://mpu.up.seesaa.net/image/16bit-wave-player-output-schema.png"></p></li>
149144
</ul>
@@ -179,8 +174,6 @@ <h4>
179174
<a id="user-content-pwm-output-port" class="anchor" href="#pwm-output-port" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>PWM output port</h4>
180175
<ul>
181176
<li>Left upper(Hi) PWM 8bit out: PB_5 (TM3_CH2)</li>
182-
</ul>
183-
<ul>
184177
<li>Right upper(Hi) PWM 8bit out: PB4 (TM3_CH1)</li>
185178
<li>Left lower(Low) PWM 8bit out: PC_9 (TM3_CH4)</li>
186179
<li>Right lower(Low) PWM 8bit out: PC_8 (TM3_CH3)</li>
@@ -189,36 +182,32 @@ <h4>
189182
<a id="user-content-led-indicator" class="anchor" href="#led-indicator" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>LED indicator</h4>
190183
<ul>
191184
<li>See <a href="https://github.com/dinau/stm32-wave-player-pwm-super-lite-nim/blob/main/port_setting.md">port_setting.md</a>.</li>
192-
</ul>
193-
<ul>
194185
<li>If set up LED device to "LED indicator port", it will be dimmer during play mode (regular speed) and pause mode (fast speed).</li>
195186
</ul>
196187
<h4>
197188
<a id="user-content-nim-compiler" class="anchor" href="#nim-compiler" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Nim compiler</h4>
198189
<ul>
199-
<li>Recomended nim compiler version is nim-1.6.0 at this time.</li>
190+
<li>Recomended nim compiler version is nim-1.6.4 at this time.</li>
200191
</ul>
201192
<h4>
202193
<a id="user-content-c-compiler-arm-none-eabi-gcc" class="anchor" href="#c-compiler-arm-none-eabi-gcc" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>C compiler: arm-none-eabi-gcc</h4>
203194
<ul>
204195
<li>v4.8.3 or later.</li>
205-
</ul>
206-
<ul>
207196
<li>Recomend <a href="https://developer.arm.com/open-source/gnu-toolchain/gnu-rm" rel="nofollow">GNU Arm Embedded Toolchain</a>
208197
</li>
209198
</ul>
210199
<h4>
211200
<a id="user-content-compiling-source-code" class="anchor" href="#compiling-source-code" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Compiling source code</h4>
212201
<ul>
213202
<li>
214-
<p>Example: (NUCLEO-L152RE board)</p>
215-
<div class="highlight highlight-source-shell"><pre>$ <span class="pl-c1">cd</span> src/L1/l152re/nucleo_l152re
203+
<p>Example: (NUCLEO-F411RE board)</p>
204+
<div class="highlight highlight-source-shell"><pre>$ <span class="pl-c1">cd</span> src/F4/f401xe/nucleo-f411re
216205
$ make
217206
.........................................................
218207
CC: xprintf
219-
CC: startup_stm32l152xe
208+
CC: startup_stm32f411xe
220209
CC: stdlib_system.nim
221-
CC: ../stm32l152xe.nim
210+
CC: ../stm32f401xe.nim
222211
CC: ../../../lib/reginfo.nim
223212
CC: ../uart.nim
224213
CC: ../pwm.nim
@@ -231,18 +220,17 @@ <h4>
231220
CC: ../../../main.nim
232221
CC: start.nim
233222
Hint: [Link]
234-
Hint: gc: none<span class="pl-k">;</span> opt: speed<span class="pl-k">;</span> options: -d:danger
235-
79440 lines<span class="pl-k">;</span> 4.460s<span class="pl-k">;</span> 77.398MiB peakmem<span class="pl-k">;</span> proj: .<span class="pl-cce">\s</span>tart<span class="pl-k">;</span> out:
223+
Hint: gc: arc<span class="pl-k">;</span> opt: speed<span class="pl-k">;</span> options: -d:danger
224+
90709 lines<span class="pl-k">;</span> 11.377s<span class="pl-k">;</span> 96.109MiB peakmem<span class="pl-k">;</span> proj: .<span class="pl-cce">\s</span>tart<span class="pl-k">;</span> out: ...
236225
text data bss dec hex filename
237-
5656 1096 124 6876 1adc BINHEX<span class="pl-cce">\n</span>ucleo_l152re.elf</pre></div>
238-
</li>
239-
</ul>
240-
<h4>
241-
<a id="user-content-generated-files-are" class="anchor" href="#generated-files-are" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Generated files are</h4>
242-
<pre><code>BINHEX/nucleo_l152re.bin
243-
BINHEX/nucleo_l152re.hex
226+
4148 16 88 4252 109c BINHEX<span class="pl-cce">\n</span>ucleo_f411re.elf</pre></div>
227+
<p>Generated files are</p>
228+
<pre><code>BINHEX/nucleo_f411re.bin
229+
BINHEX/nucleo_f411re.hex
244230
...
245231
</code></pre>
232+
</li>
233+
</ul>
246234
<p>You can just copy the <strong>bin</strong> file to mbed drive,
247235
or can flash the <strong>hex</strong> file with ST-Link utility.</p>
248236
<p>If you don't like to compile from source code, you can immediately upload <a href="https://github.com/dinau/stm32-wave-player-pwm-super-lite-nim/tree/main/doc/hex">doc/hex/*.hex or *.bin files</a> to flash.</p>
@@ -305,29 +293,41 @@ <h4>
305293
</table>
306294
<h4>
307295
<a id="user-content-pursue-small-code-size" class="anchor" href="#pursue-small-code-size" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Pursue small code size</h4>
308-
<p>In src/conf_sys.nim,by eliminating some functionalities, the code size can be further reduced.
309-
For instance, set as follows:<br>
310-
<strong>UART_INFO* = false</strong>
311-
<strong>PWM16BIT* = false</strong> ( set simple less bits mode)<br>
312-
<strong>DATA_8BIT_SUPPORT* = false</strong> ( only support PCM16bit format,neglect PCM8bit format)
313-
<strong>HAVE_LED_IND_PWM* = false</strong> ( eliminate LED indicator function)<br>
314-
<strong>FS_48KHZ_QUP* = false</strong> ( only supoort less than fs=48KHz)<br>
315-
will result in about:</p>
316-
<pre><code>text data bss dec hex filename
317-
2964 0 104 3068 bfc BUILD/nucleo_l152re.elf
318-
</code></pre>
319-
<p>In src/config.nims, uncomment and enable below option,</p>
320-
<pre><code>--passC:"-flto"
321-
--passL:"-flto"
322-
</code></pre>
323-
<p>and recompile project,</p>
324-
<pre><code>make clean
325-
make
326-
</code></pre>
296+
<p>In <code>src/conf_sys.nim</code>,by eliminating some functionalities,<br>
297+
the code size can be further reduced. For instance, set as follows:</p>
298+
<table>
299+
<thead>
300+
<tr>
301+
<th>Flags</th>
302+
<th>Descriptions</th>
303+
</tr>
304+
</thead>
305+
<tbody>
306+
<tr>
307+
<td>UART_INFO* = false</td>
308+
<td>Show information through UART</td>
309+
</tr>
310+
<tr>
311+
<td>PWM16BIT* = false</td>
312+
<td>Set simple less bits mode</td>
313+
</tr>
314+
<tr>
315+
<td>DATA_8BIT_SUPPORT* = false</td>
316+
<td>Only support PCM16bit format,neglect PCM8bit format</td>
317+
</tr>
318+
<tr>
319+
<td>HAVE_LED_IND_PWM* = false</td>
320+
<td>Eliminate LED indicator function</td>
321+
</tr>
322+
<tr>
323+
<td>FS_48KHZ_QUP* = false</td>
324+
<td>Only supoort less than fs=48KHz</td>
325+
</tr>
326+
</tbody>
327+
</table>
327328
<p>will result in about:</p>
328-
<pre><code>text data bss dec hex filename
329-
2916 0 136 3052 bec BUILD/nucleo_l152re.elf
330-
</code></pre>
329+
<div class="highlight highlight-source-shell"><pre>text data bss dec hex filename
330+
3480 16 80 3576 df8 BINHEX<span class="pl-cce">\n</span>ucleo_f411re.elf</pre></div>
331331
<p>Now it can do auto playback after power on,<br>
332332
can operate play,pause and next song with push button,<br>
333333
be able to play fairly quality sound according to Table 1,

README.md

Lines changed: 32 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
- [Nim compiler](#nim-compiler)
2121
- [C compiler: arm-none-eabi-gcc](#c-compiler-arm-none-eabi-gcc)
2222
- [Compiling source code](#compiling-source-code)
23-
- [Generated files are](#generated-files-are)
2423
- [Output music filename through UART port](#output-music-filename--through-uart-port)
2524
- [Simple less bits mode](#simple-less-bits-mode)
2625
- [Pursue small code size](#pursue-small-code-size)
@@ -56,7 +55,7 @@
5655

5756
#### Supported PCM Format
5857

59-
* PCM wav file that have file extension ".wav" on root directory.
58+
- PCM wav file that have file extension ".wav" on root directory.
6059
- 16bit/8bit, fs(sampling rate)=32kHz,44.1kHz,48kHz.
6160
- Stereo/Mono.
6261

@@ -70,7 +69,7 @@
7069

7170
#### Hardware setting/Schematic: (16bit sound resolution)
7271

73-
* Refer to the file, [port_setting.md](https://github.com/dinau/stm32-wave-player-pwm-super-lite-nim/blob/main/port_setting.md).
72+
- Refer to the file, [port_setting.md](https://github.com/dinau/stm32-wave-player-pwm-super-lite-nim/blob/main/port_setting.md).
7473
- See folder doc\/*
7574
![](http://mpu.up.seesaa.net/image/16bit-wave-player-output-schema.png)
7675

@@ -107,37 +106,37 @@ Pin side
107106

108107
#### PWM output port
109108

110-
* Left upper(Hi) PWM 8bit out: PB_5 (TM3_CH2)
109+
- Left upper(Hi) PWM 8bit out: PB_5 (TM3_CH2)
111110
- Right upper(Hi) PWM 8bit out: PB4 (TM3_CH1)
112111
- Left lower(Low) PWM 8bit out: PC_9 (TM3_CH4)
113112
- Right lower(Low) PWM 8bit out: PC_8 (TM3_CH3)
114113

115114
#### LED indicator
116115

117-
* See [port_setting.md](https://github.com/dinau/stm32-wave-player-pwm-super-lite-nim/blob/main/port_setting.md).
116+
- See [port_setting.md](https://github.com/dinau/stm32-wave-player-pwm-super-lite-nim/blob/main/port_setting.md).
118117
- If set up LED device to "LED indicator port", it will be dimmer during play mode (regular speed) and pause mode (fast speed).
119118

120119
#### Nim compiler
121120

122-
* Recomended nim compiler version is nim-1.6.0 at this time.
121+
* Recomended nim compiler version is nim-1.6.4 at this time.
123122

124123
#### C compiler: arm-none-eabi-gcc
125124

126-
* v4.8.3 or later.
125+
- v4.8.3 or later.
127126
- Recomend [GNU Arm Embedded Toolchain](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm)
128127

129128
#### Compiling source code
130129

131-
* Example: (NUCLEO-L152RE board)
130+
* Example: (NUCLEO-F411RE board)
132131

133132
```sh
134-
$ cd src/L1/l152re/nucleo_l152re
133+
$ cd src/F4/f401xe/nucleo-f411re
135134
$ make
136135
.........................................................
137136
CC: xprintf
138-
CC: startup_stm32l152xe
137+
CC: startup_stm32f411xe
139138
CC: stdlib_system.nim
140-
CC: ../stm32l152xe.nim
139+
CC: ../stm32f401xe.nim
141140
CC: ../../../lib/reginfo.nim
142141
CC: ../uart.nim
143142
CC: ../pwm.nim
@@ -150,19 +149,19 @@ Pin side
150149
CC: ../../../main.nim
151150
CC: start.nim
152151
Hint: [Link]
153-
Hint: gc: none; opt: speed; options: -d:danger
154-
79440 lines; 4.460s; 77.398MiB peakmem; proj: .\start; out:
152+
Hint: gc: arc; opt: speed; options: -d:danger
153+
90709 lines; 11.377s; 96.109MiB peakmem; proj: .\start; out: ...
155154
text data bss dec hex filename
156-
5656 1096 124 6876 1adc BINHEX\nucleo_l152re.elf
155+
4148 16 88 4252 109c BINHEX\nucleo_f411re.elf
157156
```
158157

159-
#### Generated files are
158+
Generated files are
160159

161-
```
162-
BINHEX/nucleo_l152re.bin
163-
BINHEX/nucleo_l152re.hex
164-
...
165-
```
160+
```
161+
BINHEX/nucleo_f411re.bin
162+
BINHEX/nucleo_f411re.hex
163+
...
164+
```
166165
167166
You can just copy the **bin** file to mbed drive,
168167
or can flash the **hex** file with ST-Link utility.
@@ -196,31 +195,23 @@ In spite of less parts, wirings and PCM bit length, it has fairly sound quality.
196195
197196
#### Pursue small code size
198197
199-
In src/conf_sys.nim,by eliminating some functionalities, the code size can be further reduced.
200-
For instance, set as follows:
201-
**UART_INFO\* = false**
202-
**PWM16BIT\* = false** ( set simple less bits mode)
203-
**DATA_8BIT_SUPPORT\* = false** ( only support PCM16bit format,neglect PCM8bit format)
204-
**HAVE_LED_IND_PWM\* = false** ( eliminate LED indicator function)
205-
**FS_48KHZ_QUP\* = false** ( only supoort less than fs=48KHz)
206-
will result in about:
207-
208-
text data bss dec hex filename
209-
2964 0 104 3068 bfc BUILD/nucleo_l152re.elf
198+
In `src/conf_sys.nim`,by eliminating some functionalities,
199+
the code size can be further reduced. For instance, set as follows:
210200
211-
In src/config.nims, uncomment and enable below option,
201+
| Flags | Descriptions |
202+
|------------------------------------|-----------------------------------------------------|
203+
| UART_INFO\* = false | Show information through UART |
204+
| PWM16BIT\* = false | Set simple less bits mode |
205+
| DATA_8BIT_SUPPORT\* = false | Only support PCM16bit format,neglect PCM8bit format |
206+
| HAVE_LED_IND_PWM\* = false | Eliminate LED indicator function |
207+
| FS_48KHZ_QUP\* = false | Only supoort less than fs=48KHz |
212208
213-
--passC:"-flto"
214-
--passL:"-flto"
215-
216-
and recompile project,
217-
218-
make clean
219-
make
220209
will result in about:
221210
222-
text data bss dec hex filename
223-
2916 0 136 3052 bec BUILD/nucleo_l152re.elf
211+
```sh
212+
text data bss dec hex filename
213+
3480 16 80 3576 df8 BINHEX\nucleo_f411re.elf
214+
```
224215

225216
Now it can do auto playback after power on,
226217
can operate play,pause and next song with push button,

0 commit comments

Comments
 (0)