summaryrefslogtreecommitdiff
path: root/scripts/build/arch/c6x.sh
blob: 3eb40e47a1e3a626c733d7d85e2ee21ff9b1988d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Compute c6x-specific values

CT_DoArchUClibcConfig() {
    local cfg="${1}"

    CT_DoArchUClibcSelectArch "${cfg}" "c6x"
}

CT_DoArchTupleValues() {
    CT_TARGET_ARCH="tic6x"
    #binutils does not like uclibc in the tuple
    if [ "${CT_TARGET_SYS}" = "uclibc" ]; then
        CT_TARGET_SYS=
    fi
}

CT_DoArchUClibcHeaderDir() {
    local dir_var="${1}"
    local cflags="${2}"

    # If it is non-default multilib, add a suffix with architecture (reported by gcc)
    # to the headers installation path.
    if [ -n "${cflags}" ]; then
        eval "${dir_var}="$( ${CT_TARGET}-${CT_CC} -print-multiarch ${cflags} )
    fi
}

CT_DoArchUClibcCflags() {
    local cfg="${1}"
    local cflags="${2}"
    local f

    # Set default little endian options
    CT_KconfigDisableOption "ARCH_BIG_ENDIAN" "${cfg}"
    CT_KconfigDisableOption "ARCH_WANTS_BIG_ENDIAN" "${cfg}"
    CT_KconfigEnableOption "ARCH_LITTLE_ENDIAN" "${cfg}"
    CT_KconfigEnableOption "ARCH_WANTS_LITTLE_ENDIAN" "${cfg}"

    # Set arch options based on march switch
    CT_KconfigDisableOption "CONFIG_TMS320C674X" "${cfg}"
    CT_KconfigDisableOption "CONFIG_TMS320C64XPLUS" "${cfg}"
    CT_KconfigDisableOption "CONFIG_TMS320C64X" "${cfg}"
    CT_KconfigDisableOption "UCLIBC_HAS_FPU" "${cfg}"
    CT_KconfigEnableOption "CONFIG_GENERIC_C6X" "${cfg}"

    for f in ${cflags}; do
        case "${f}" in
            -march=*)
                case "${f#-march=}" in
                    c674x)  
                        CT_KconfigEnableOption "CONFIG_TMS320C674X" "${cfg}"
                        CT_KconfigEnableOption "UCLIBC_HAS_FPU" "${cfg}"
                        CT_KconfigDisableOption "CONFIG_GENERIC_C6X" "${cfg}"
                        ;;
                    c64x+) 
                        CT_KconfigEnableOption "CONFIG_TMS320C64XPLUS" "${cfg}"
                        CT_KconfigDisableOption "CONFIG_GENERIC_C6X" "${cfg}"
                        ;;
                    c64x)  
                        CT_KconfigEnableOption "CONFIG_TMS320C64X" "${cfg}"
                        CT_KconfigDisableOption "CONFIG_GENERIC_C6X" "${cfg}"
                        ;;
                    c67x)
                        CT_KconfigEnableOption "UCLIBC_HAS_FPU" "${cfg}"
                        ;;
                    c62x)
                        ;;
                    *)   CT_Abort "Unsupported architecture: ${f#-march=}";;
                esac
                ;;
            -mbig-endian)
                CT_KconfigEnableOption "ARCH_BIG_ENDIAN" "${cfg}"
                CT_KconfigEnableOption "ARCH_WANTS_BIG_ENDIAN" "${cfg}"
                CT_KconfigDisableOption "ARCH_LITTLE_ENDIAN" "${cfg}"
                CT_KconfigDisableOption "ARCH_WANTS_LITTLE_ENDIAN" "${cfg}"
                ;;
        esac
    done
}