<commit_before># Project generator definitions

This repository defines definitions for targets and mcus. They are used to set proper data in the tools.

## Create a new mcu yaml definition

This module provides a script to extract the information needed to create a new yaml mcu definiton file.

An example for creating mcu.yaml for lpc1768, from a project file lpc1768_blinky.ewp (IAR)

```
progendef create -m lpc1768 -t iar -f lpc1768_blinky.ewp
```

This creates lpc1768.yaml file in the current directory.

## YAML records

### Target

To generalize MCU's, there's a target definition available. The target name does not change based on the tool used. There's file board_definitions, where are all boards supported defined. There's a dictionary which translates the target name to the tool's specific MCU name.

If a project defines frdm-k20d50m as target, the proper mcu settings will be set for a tool.

Each mcu has own tool_specific definitions.

```
target:
    name:
        - frdm-k64f
    mcu:
        - mcu/freescale/mk64fn1m0xxx12
```

### MCU

MCU record defines the basic information about the mcu and specific settings for each tool. As an example is shown the uvision settings for the lpc1768 mcu. These specific data can be manually extracted from a project file or use progendef commad to create the yaml file for you.

```
mcu:
    vendor:
        - nxp
    name:
        - lpc1768
    core:
        - cortex-m3
tool_specific:
    uvision:
        TargetOption:
            Device:
                - LPC1768
            Vendor:
                - NXP
            Cpu:
                - IRAM(0x10000000-0x10007FFF) IRAM2(0x2007C000-0x20083FFF) IROM(0-0x7FFFF) CLOCK(12000000) CPUTYPE("Cortex-M3")
            FlashDriverDll:
                - UL2CM3(-O463 -S0 -C0 -FO7 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000)<commit_msg>Readme - target correction based on the target vs mcu refactor<commit_after># Project generator definitions

This repository defines definitions for targets and mcus. They are used to set proper data in the tools.

## Create a new mcu yaml definition

This module provides a script to extract the information needed to create a new yaml mcu definiton file.

An example for creating mcu.yaml for lpc1768, from a project file lpc1768_blinky.ewp (IAR)

```
progendef create -m lpc1768 -t iar -f lpc1768_blinky.ewp
```

This creates lpc1768.yaml file in the current directory.

## YAML records

### Targets

To generalize MCU's, there're targets definition available. The target name does not change based on the tool used. We provide a dictionary where we can define a target with mcu, for instance:

```
PROGENDEF_TARGETS = {
    'arch-ble': 'mcu/nordic/nrf51',
}
```

If a project can either use arch-ble as a target or nrf51 (mcu). 

### MCU

MCU record defines the basic information about the mcu and specific settings for each tool. As an example is shown the uvision settings for the lpc1768 mcu. These specific data can be manually extracted from a project file or use progendef commad to create the yaml file for you.

If you are adding a new mcu, please follow the uvision naming for MCUs, for consistency.

```
mcu:
    vendor:
        - nxp
    name:
        - lpc1768
    core:
        - cortex-m3
tool_specific:
    uvision:
        TargetOption:
            Device:
                - LPC1768
            Vendor:
                - NXP
            Cpu:
                - IRAM(0x10000000-0x10007FFF) IRAM2(0x2007C000-0x20083FFF) IROM(0-0x7FFFF) CLOCK(12000000) CPUTYPE("Cortex-M3")
            FlashDriverDll:
                - UL2CM3(-O463 -S0 -C0 -FO7 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000)
{'fraction_non_alphanumeric': 0.06420021762785637, 'fraction_numerical': 0.06256800870511425, 'mean_word_length': 2.790721649484536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5460968', 'n_tokens_mistral': 1306, 'n_tokens_neox': 1125, 'n_words': 460}