mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			LPC55S69: Change post-build hook to create HEX
							parent
							
								
									ebd9dc83f7
								
							
						
					
					
						commit
						401580f364
					
				| 
						 | 
				
			
			@ -9,25 +9,31 @@ These images were compiled by the following command:
 | 
			
		|||
## tfm.bin
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
mbed compile -t ARMC6 -m LPC55S69_S --app-config tools/psa/tfm/mbed_app.json --profile release
 | 
			
		||||
mbed compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json --profile release
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## spm_smoke.bin
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
mbed test --compile -t ARMC6 -m LPC55S69_S --app-config tools/psa/tfm/mbed_app.json -n tests-psa-spm_smoke -DUSE_PSA_TEST_PARTITIONS -DUSE_SMOKE_TESTS_PART1 --profile release
 | 
			
		||||
mbed test --compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json -n mbed-os-tests-psa-spm_smoke -DUSE_PSA_TEST_PARTITIONS -DUSE_SMOKE_TESTS_PART1 --profile release
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## spm_client.bin
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
mbed test --compile -t ARMC6 -m LPC55S69_S --app-config tools/psa/tfm/mbed_app.json -n tests-psa-spm_client -DUSE_PSA_TEST_PARTITIONS -DUSE_CLIENT_TESTS_PART1 --profile release
 | 
			
		||||
mbed test --compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json -n mbed-os-tests-psa-spm_client -DUSE_PSA_TEST_PARTITIONS -DUSE_CLIENT_TESTS_PART1 --profile release
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## spm_server.bin
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
mbed test --compile -t ARMC6 -m LPC55S69_S --app-config tools/psa/tfm/mbed_app.json -n tests-psa-spm_server -DUSE_PSA_TEST_PARTITIONS -DUSE_SERVER_TESTS_PART1 -DUSE_SERVER_TESTS_PART2 --profile release
 | 
			
		||||
mbed test --compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json -n mbed-os-tests-psa-spm_server -DUSE_PSA_TEST_PARTITIONS -DUSE_SERVER_TESTS_PART1 -DUSE_SERVER_TESTS_PART2 --profile release
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## crypto_access_control.bin
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
mbed test --compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json -n mbed-os-tests-psa-crypto_access_control -DUSE_PSA_TEST_PARTITIONS -DUSE_CRYPTO_ACL_TEST --profile release
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
To update the prebuilt binaries run the previous commands.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -2100,7 +2100,8 @@
 | 
			
		|||
            "secure-rom-size": "0x30000",
 | 
			
		||||
            "secure-ram-start": "0x30000000",
 | 
			
		||||
            "secure-ram-size": "0x22000"
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
        "OUTPUT_EXT": "hex"
 | 
			
		||||
    },
 | 
			
		||||
    "LPC55S69_S": {
 | 
			
		||||
        "inherits": ["SPE_Target", "LPC55S69"],
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,34 +15,23 @@
 | 
			
		|||
 #
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
from os.path import abspath, basename, dirname, splitext
 | 
			
		||||
from os.path import abspath, dirname
 | 
			
		||||
from os.path import join as path_join
 | 
			
		||||
import tempfile
 | 
			
		||||
 | 
			
		||||
from tools.psa.tfm.bin_utils.assemble import Assembly
 | 
			
		||||
from intelhex import IntelHex
 | 
			
		||||
 | 
			
		||||
SCRIPT_DIR = dirname(abspath(__file__))
 | 
			
		||||
MBED_OS_ROOT = abspath(path_join(SCRIPT_DIR, os.pardir, os.pardir))
 | 
			
		||||
LPC55S69_BASE = path_join(MBED_OS_ROOT, 'targets', 'TARGET_NXP', 'TARGET_MCUXpresso_MCUS', 'TARGET_LPC55S69')
 | 
			
		||||
 | 
			
		||||
def lpc55s69_tfm_bin(t_self, non_secure_bin, secure_bin):
 | 
			
		||||
    tempdir = tempfile.mkdtemp()
 | 
			
		||||
    flash_layout = path_join(LPC55S69_BASE, 'partition', 'flash_layout.h')
 | 
			
		||||
    ns_bin_name, ns_bin_ext = splitext(basename(non_secure_bin))
 | 
			
		||||
    concatenated_bin = path_join(tempdir, 'tfm_' + ns_bin_name + ns_bin_ext)
 | 
			
		||||
 | 
			
		||||
    assert os.path.isfile(flash_layout)
 | 
			
		||||
def lpc55s69_complete(t_self, non_secure_bin, secure_bin):
 | 
			
		||||
    assert os.path.isfile(secure_bin)
 | 
			
		||||
    assert os.path.isfile(non_secure_bin)
 | 
			
		||||
 | 
			
		||||
    #1. Concatenate secure TFM and non-secure mbed binaries
 | 
			
		||||
    output = Assembly(flash_layout, concatenated_bin)
 | 
			
		||||
    output.add_image(secure_bin, "SECURE")
 | 
			
		||||
    output.add_image(non_secure_bin, "NON_SECURE")
 | 
			
		||||
 | 
			
		||||
    #2. Delete the original binary file name
 | 
			
		||||
    os.remove(non_secure_bin)
 | 
			
		||||
 | 
			
		||||
    #3. Rename to new concatenated binary to the original binary file name
 | 
			
		||||
    os.rename(concatenated_bin, non_secure_bin)
 | 
			
		||||
    ns_hex = IntelHex(non_secure_bin)
 | 
			
		||||
    s_hex = IntelHex()
 | 
			
		||||
    s_hex.loadbin(secure_bin)
 | 
			
		||||
 | 
			
		||||
    s_hex.merge(ns_hex, overlap='ignore')
 | 
			
		||||
    s_hex.tofile(non_secure_bin, 'hex')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -603,10 +603,10 @@ class LPC55S69Code:
 | 
			
		|||
    """LPC55S69 Hooks"""
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def binary_hook(t_self, resources, elf, binf):
 | 
			
		||||
        from tools.targets.LPC55S69 import lpc55s69_tfm_bin
 | 
			
		||||
        from tools.targets.LPC55S69 import lpc55s69_complete
 | 
			
		||||
        configured_secure_image_filename = t_self.target.secure_image_filename
 | 
			
		||||
        secure_bin = find_secure_image(t_self.notify, resources, binf, configured_secure_image_filename, FileType.BIN)
 | 
			
		||||
        lpc55s69_tfm_bin(t_self, binf, secure_bin)
 | 
			
		||||
        lpc55s69_complete(t_self, binf, secure_bin)
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue