As of August 2020 the site you are on (wiki.newae.com) is deprecated, and content is now at rtfm.newae.com. |
Difference between revisions of "Building for Other Targets"
(Created page with "You'll need to have installed the GNU Embedded Toolchain for ARM. If you haven't yet, see the Installing_ChipWhisperer guide, specifically the '''Installing ARM Toolchain'...") |
(Tag: VisualEditor) |
||
Line 1: | Line 1: | ||
− | + | Building for other targets typically requires additional programs and tools. Additionally, some targets may have a unique build process, meaning the instructions here will not apply to them. Please see the page for the specific target you want to build for before following these instructions, which can be found under the '''Hardware Documentation''' section of the [[Main Page]]. | |
− | Once you have a working compiler | + | Once you have a working compiler: |
<ol style="list-style-type: decimal;"> | <ol style="list-style-type: decimal;"> | ||
<li>We want to use the existing SimpleSerial firmware as a base for our project, but we don't want to edit the existing firmware. Instead, we'll make a new project with a copy of this firmware. Copy the directory of the firmware you want to modify in the <code>chipwhisperer/hardware/vicitims/firmware</code> to a new folder. For example, if you want to modify the <code>simpleserial-base</code> firmware, copy the contents of the <code>simpleserial-base</code> folder to a new one. The name is arbitrary, but for this example, we'll call it <code>simpleserial-base-lab1</code>. You must keep it in the same directory, as it will reference other files within that directory for the build process.</li> | <li>We want to use the existing SimpleSerial firmware as a base for our project, but we don't want to edit the existing firmware. Instead, we'll make a new project with a copy of this firmware. Copy the directory of the firmware you want to modify in the <code>chipwhisperer/hardware/vicitims/firmware</code> to a new folder. For example, if you want to modify the <code>simpleserial-base</code> firmware, copy the contents of the <code>simpleserial-base</code> folder to a new one. The name is arbitrary, but for this example, we'll call it <code>simpleserial-base-lab1</code>. You must keep it in the same directory, as it will reference other files within that directory for the build process.</li> | ||
− | |||
− | |||
− | |||
<li><p>Change the terminal to the newly copied directory. For example:</p> | <li><p>Change the terminal to the newly copied directory. For example:</p> | ||
Windows:<pre>cd c:\chipwhisperer\hardware\victims\firmware\simpleserial-base-lab1</pre> | Windows:<pre>cd c:\chipwhisperer\hardware\victims\firmware\simpleserial-base-lab1</pre> | ||
Linux/macOS:<pre>cd chipwhisperer/hardware/victims/firmware/simpleserial-base-lab1</pre></li> | Linux/macOS:<pre>cd chipwhisperer/hardware/victims/firmware/simpleserial-base-lab1</pre></li> | ||
− | <li><p>Then, run <code>make</code> to build the system. Make sure you specify which platform you're using as your target. For example, for the | + | <li><p>Then, run <code>make</code> to build the system. Make sure you specify which platform you're using as your target. You can see a list of supported targets by typing <code>make PLATFORM=</code>. You'll also need to specify a <code>CRYPTO_TARGET</code>. Most targets and tutorials work with <code>TINYAES128C</code>, so if you're unsure, this is usually a reliable option. For example, for the NXP Kinetis K24F target, run:</p> |
− | <pre>make PLATFORM= | + | <pre>make PLATFORM=CW308_K24F CRYPTO_TARGET=TINYAES128C</pre> |
<p>Which should have the following output:</p> | <p>Which should have the following output:</p> | ||
<pre>...Bunch of lines removed... | <pre>...Bunch of lines removed... | ||
− | Linking: simpleserial-base- | + | Linking: simpleserial-base-CW308_K24F.elf |
− | arm-none-eabi-gcc -mcpu=cortex-m4 | + | arm-none-eabi-gcc -I. -O0 -g -DDEBUG -DCPU_MK24FN1M0VLL12 -DFRDM_K64F -DFREEDOM -w -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mthumb -mapcs -std=gnu99 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -MMD -MP -static -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_k24f -DPLATFORM=CW308_K24F -DTINYAES128C -DF_CPU=7372800UL -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=objdir/simpleserial-base.o -I.././simpleserial/ -I.././hal -I.././hal/k24f -I.././hal/k24f/CMSIS -I.././hal/k24f/Drivers -I.././crypto/ -I.././crypto/tiny-AES128-C -std=gnu99 -MMD -MP -MF .dep/simpleserial-base-CW308_K24F.elf.d objdir/simpleserial-base.o objdir/simpleserial.o objdir/clock_config.o objdir/fsl_adc16.o objdir/fsl_clock.o objdir/fsl_cmp.o objdir/fsl_cmt.o objdir/fsl_common.o objdir/fsl_crc.o objdir/fsl_dac.o objdir/fsl_dmamux.o objdir/fsl_dspi.o objdir/fsl_dspi_edma.o objdir/fsl_edma.o objdir/fsl_ewm.o objdir/fsl_flash.o objdir/fsl_flexbus.o objdir/fsl_flexcan.o objdir/fsl_ftm.o objdir/fsl_gpio.o objdir/fsl_i2c.o objdir/fsl_i2c_edma.o objdir/fsl_llwu.o objdir/fsl_lptmr.o objdir/fsl_mmcau.o objdir/fsl_pdb.o objdir/fsl_pit.o objdir/fsl_pmc.o objdir/fsl_rcm.o objdir/fsl_rnga.o objdir/fsl_rtc.o objdir/fsl_sai.o objdir/fsl_sai_edma.o objdir/fsl_sdhc.o objdir/fsl_sim.o objdir/fsl_smc.o objdir/fsl_sysmpu.o objdir/fsl_uart.o objdir/fsl_uart_edma.o objdir/fsl_vref.o objdir/fsl_wdog.o objdir/k24f_hal.o objdir/system_MK24F12.o objdir/aes.o objdir/aes-independant.o objdir/startup_MK24F12.o --output simpleserial-base-CW308_K24F.elf -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -T .././hal/k24f/MK24FN1M0xxx12_flash.ld --specs=nano.specs --specs=nosys.specs -Wl,--start-group -L .././hal/k24f/ -l:lib_mmcau.a -lm -lc -lgcc -lnosys -Wl,--end-group -Wl,-Map=simpleserial-base-CW308_K24F.map,--cref -lm |
. | . | ||
− | Creating load file for Flash: simpleserial-base- | + | Creating load file for Flash: simpleserial-base-CW308_K24F.hex |
− | arm-none-eabi-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature simpleserial-base- | + | arm-none-eabi-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature simpleserial-base-CW308_K24F.elf simpleserial-base-CW308_K24F.hex |
. | . | ||
− | Creating load file for EEPROM: simpleserial-base- | + | Creating load file for EEPROM: simpleserial-base-CW308_K24F.eep |
arm-none-eabi-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \ | arm-none-eabi-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \ | ||
− | --change-section-lma .eeprom=0 --no-change-warnings -O ihex simpleserial-base- | + | --change-section-lma .eeprom=0 --no-change-warnings -O ihex simpleserial-base-CW308_K24F.elf simpleserial-base-CW308_K24F.eep || exit 0 |
. | . | ||
− | Creating Extended Listing: simpleserial-base- | + | Creating Extended Listing: simpleserial-base-CW308_K24F.lss |
− | arm-none-eabi-objdump -h -S -z simpleserial-base- | + | arm-none-eabi-objdump -h -S -z simpleserial-base-CW308_K24F.elf > simpleserial-base-CW308_K24F.lss |
. | . | ||
− | Creating Symbol Table: simpleserial-base- | + | Creating Symbol Table: simpleserial-base-CW308_K24F.sym |
− | arm-none-eabi-nm -n simpleserial-base- | + | arm-none-eabi-nm -n simpleserial-base-CW308_K24F.elf > simpleserial-base-CW308_K24F.sym |
Size after: | Size after: | ||
text data bss dec hex filename | text data bss dec hex filename | ||
− | + | 11600 120 2388 14108 371c simpleserial-base-CW308_K24F.elf | |
+-------------------------------------------------------- | +-------------------------------------------------------- | ||
− | + Built for platform | + | + Built for platform k24f Target |
+-------------------------------------------------------- | +-------------------------------------------------------- | ||
</pre></li> | </pre></li> | ||
Ensure that the "Built for platform ___" matches your target device. | Ensure that the "Built for platform ___" matches your target device. | ||
</ol> | </ol> |
Revision as of 06:31, 28 September 2018
Building for other targets typically requires additional programs and tools. Additionally, some targets may have a unique build process, meaning the instructions here will not apply to them. Please see the page for the specific target you want to build for before following these instructions, which can be found under the Hardware Documentation section of the Main Page.
Once you have a working compiler:
- We want to use the existing SimpleSerial firmware as a base for our project, but we don't want to edit the existing firmware. Instead, we'll make a new project with a copy of this firmware. Copy the directory of the firmware you want to modify in the
chipwhisperer/hardware/vicitims/firmware
to a new folder. For example, if you want to modify thesimpleserial-base
firmware, copy the contents of thesimpleserial-base
folder to a new one. The name is arbitrary, but for this example, we'll call itsimpleserial-base-lab1
. You must keep it in the same directory, as it will reference other files within that directory for the build process. Change the terminal to the newly copied directory. For example:
Windows:cd c:\chipwhisperer\hardware\victims\firmware\simpleserial-base-lab1
Linux/macOS:cd chipwhisperer/hardware/victims/firmware/simpleserial-base-lab1
Then, run
make
to build the system. Make sure you specify which platform you're using as your target. You can see a list of supported targets by typingmake PLATFORM=
. You'll also need to specify aCRYPTO_TARGET
. Most targets and tutorials work withTINYAES128C
, so if you're unsure, this is usually a reliable option. For example, for the NXP Kinetis K24F target, run:make PLATFORM=CW308_K24F CRYPTO_TARGET=TINYAES128C
Which should have the following output:
...Bunch of lines removed... Linking: simpleserial-base-CW308_K24F.elf arm-none-eabi-gcc -I. -O0 -g -DDEBUG -DCPU_MK24FN1M0VLL12 -DFRDM_K64F -DFREEDOM -w -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mthumb -mapcs -std=gnu99 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -MMD -MP -static -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_k24f -DPLATFORM=CW308_K24F -DTINYAES128C -DF_CPU=7372800UL -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=objdir/simpleserial-base.o -I.././simpleserial/ -I.././hal -I.././hal/k24f -I.././hal/k24f/CMSIS -I.././hal/k24f/Drivers -I.././crypto/ -I.././crypto/tiny-AES128-C -std=gnu99 -MMD -MP -MF .dep/simpleserial-base-CW308_K24F.elf.d objdir/simpleserial-base.o objdir/simpleserial.o objdir/clock_config.o objdir/fsl_adc16.o objdir/fsl_clock.o objdir/fsl_cmp.o objdir/fsl_cmt.o objdir/fsl_common.o objdir/fsl_crc.o objdir/fsl_dac.o objdir/fsl_dmamux.o objdir/fsl_dspi.o objdir/fsl_dspi_edma.o objdir/fsl_edma.o objdir/fsl_ewm.o objdir/fsl_flash.o objdir/fsl_flexbus.o objdir/fsl_flexcan.o objdir/fsl_ftm.o objdir/fsl_gpio.o objdir/fsl_i2c.o objdir/fsl_i2c_edma.o objdir/fsl_llwu.o objdir/fsl_lptmr.o objdir/fsl_mmcau.o objdir/fsl_pdb.o objdir/fsl_pit.o objdir/fsl_pmc.o objdir/fsl_rcm.o objdir/fsl_rnga.o objdir/fsl_rtc.o objdir/fsl_sai.o objdir/fsl_sai_edma.o objdir/fsl_sdhc.o objdir/fsl_sim.o objdir/fsl_smc.o objdir/fsl_sysmpu.o objdir/fsl_uart.o objdir/fsl_uart_edma.o objdir/fsl_vref.o objdir/fsl_wdog.o objdir/k24f_hal.o objdir/system_MK24F12.o objdir/aes.o objdir/aes-independant.o objdir/startup_MK24F12.o --output simpleserial-base-CW308_K24F.elf -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -T .././hal/k24f/MK24FN1M0xxx12_flash.ld --specs=nano.specs --specs=nosys.specs -Wl,--start-group -L .././hal/k24f/ -l:lib_mmcau.a -lm -lc -lgcc -lnosys -Wl,--end-group -Wl,-Map=simpleserial-base-CW308_K24F.map,--cref -lm . Creating load file for Flash: simpleserial-base-CW308_K24F.hex arm-none-eabi-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature simpleserial-base-CW308_K24F.elf simpleserial-base-CW308_K24F.hex . Creating load file for EEPROM: simpleserial-base-CW308_K24F.eep arm-none-eabi-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \ --change-section-lma .eeprom=0 --no-change-warnings -O ihex simpleserial-base-CW308_K24F.elf simpleserial-base-CW308_K24F.eep || exit 0 . Creating Extended Listing: simpleserial-base-CW308_K24F.lss arm-none-eabi-objdump -h -S -z simpleserial-base-CW308_K24F.elf > simpleserial-base-CW308_K24F.lss . Creating Symbol Table: simpleserial-base-CW308_K24F.sym arm-none-eabi-nm -n simpleserial-base-CW308_K24F.elf > simpleserial-base-CW308_K24F.sym Size after: text data bss dec hex filename 11600 120 2388 14108 371c simpleserial-base-CW308_K24F.elf +-------------------------------------------------------- + Built for platform k24f Target +--------------------------------------------------------
Ensure that the "Built for platform ___" matches your target device.