4 # This bash script generates CMSIS Documentation:
7 # - bash shell (for Windows: install git for Windows)
13 DIRNAME=$(dirname $(readlink -f $0))
14 DOXYGEN=$(which doxygen)
15 MSCGEN=$(which mscgen)
17 ALLPARTS=($(find ${DIRNAME} -mindepth 1 -maxdepth 1 -type d -exec basename {} \;))
20 if [[ -z "$*" ]]; then
24 if [[ " ${ALLPARTS[@]} " =~ " $part " ]]; then
30 if [[ ! -f "${DOXYGEN}" ]]; then
31 echo "Doxygen not found!" >&2
32 echo "Did you miss to add it to PATH?"
35 version=$("${DOXYGEN}" --version)
36 echo "DOXYGEN is ${DOXYGEN} at version ${version}"
37 if [[ "${version}" != "1.8.6" ]]; then
38 echo " >> Version is different from 1.8.6 !" >&2
42 if [[ ! -f "${MSCGEN}" ]]; then
43 echo "mscgen not found!" >&2
44 echo "Did you miss to add it to PATH?"
47 version=$("${MSCGEN}" 2>/dev/null | grep "Mscgen version" | sed -r -e 's/Mscgen version ([^,]+),.*/\1/')
48 echo "MSCGEN is ${MSCGEN} at version ${version}"
49 if [[ "${version}" != "0.20" ]]; then
50 echo " >> Version is different from 0.20 !" >&2
55 partname=$(basename $(dirname $1))
56 if [[ $REGEN != 0 ]] || [[ " ${PARTS[@]} " =~ " ${partname} " ]]; then
57 pushd "$(dirname $1)" > /dev/null
59 "${DOXYGEN}" $(basename "$1")
62 if [[ $2 != 0 ]]; then
63 cp -f "${DIRNAME}/Doxygen_Templates/search.css" "${DIRNAME}/../Documentation/${partname}/html/search/"
66 projectName=$(grep -E "PROJECT_NAME\s+=" $1 | sed -r -e 's/[^"]*"([^"]+)"/\1/')
67 projectNumber=$(grep -E "PROJECT_NUMBER\s+=" $1 | sed -r -e 's/[^"]*"([^"]+)"/\1/')
68 datetime=$(date -u +'%a %b %e %Y %H:%M:%S')
69 sed -e "s/{datetime}/${datetime}/" "${DIRNAME}/Doxygen_Templates/cmsis_footer.js" \
70 | sed -e "s/{projectName}/${projectName}/" \
71 | sed -e "s/{projectNumber}/${projectNumber}/" \
72 > "${DIRNAME}/../Documentation/${partname}/html/cmsis_footer.js"
76 if [[ $REGEN != 0 ]]; then
77 echo "Cleaning existing documentation ..."
78 find "${DIRNAME}/../Documentation/" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} +
81 echo "Generating documentation ..."
82 doxygen "${DIRNAME}/Build/Build.dxy" 1
83 doxygen "${DIRNAME}/Core/core.dxy" 1
84 doxygen "${DIRNAME}/Core_A/core_A.dxy" 1
85 doxygen "${DIRNAME}/DAP/dap.dxy" 1
86 doxygen "${DIRNAME}/Driver/Driver.dxy" 1
87 doxygen "${DIRNAME}/DSP/dsp.dxy" 1
88 doxygen "${DIRNAME}/General/general.dxy" 0
89 doxygen "${DIRNAME}/DAP/dap.dxy" 1
90 doxygen "${DIRNAME}/NN/nn.dxy" 1
91 doxygen "${DIRNAME}/Pack/Pack.dxy" 1
92 doxygen "${DIRNAME}/RTOS/rtos.dxy" 1
93 doxygen "${DIRNAME}/RTOS2/rtos.dxy" 1
94 doxygen "${DIRNAME}/SVD/svd.dxy" 0
95 doxygen "${DIRNAME}/Zone/zone.dxy" 1