A compound represented by formula or a pharmaceutically acceptable salt thereof, wherein A is N or CR'; R' is H, C 1 -C 8 alkyl optionally substituted by one or more halogen atoms; R 1 is selected from H; C 1 -C 8 alkyl optionally substituted by one or more halogen atoms, OH, C 1 -C 4 alkoxy, C 3 -C 7 cycloalkyl or C 3 -C 7 cycloalkyloxy; -(C 2 -C 4 alkyl)-NR 19 R 21 and C 3 -C 7 cycloalkyl; or R 1 is -X-Y; or R 1 is -W-R 7 -X-Y; or R 1 is -S 2 -X-Y; or R 1 is -S 2 -W-R 7 -X-Y; R 2 is selected from H; C 1 -C 8 alkyl optionally substituted by one or more halogen atoms, OH, C 1 -C 4 alkoxy, C 3 -C 7 cycloalkyl or C 3 -C 7 cycloalkyloxy; C 1 -C 4 alkoxy; -(C 0 -C 4 alkyl)-NR 19 R 21 and C 3 -C 7 cycloalkyl; or R 2 is -X-Y; or R 2 is -W-R 7 -X-Y; or R 2 is -S 2 -X-Y; or R 2 is -S 2 -W-R 7 -X-Y; R 2a is selected from H; C 1 -C 8 alkyl optionally substituted by one or more halogen atoms, OH, C 1 -C 4 alkoxy, C 3 -C 7 cycloalkyl or C 3 -C 7 cycloalkyloxy; and C 3 -C 7 cycloalkyl; or R 2 and R 2a taken together are oxo; wherein one of R 1 and R 2 is -X-Y, -W-R 7 -X-Y, -S 2 -X-Y; or -S 2 -W-R 7 -X-Y; R 3 is independently selected from H; C 1 -C 8 alkyl optionally substituted by one or more halogen atoms, OH, C 1 -C 4 alkoxy, C 3 -C 7 cycloalkyl or C 3 -C 7 cycloalkyloxy; -OH; OR'; -(C 0 -C 4 alkyl)-NR 19 R 21; CN; halogen; -(C 0 -C 4 alkyl)-C 6 -C 14 aryl; -(C 0 -C 4 alkyl)-4 to 14 membered heteroaryl; -C(=O)H; -C(=O)OH; -C(=O)NR 19 R 21 and C 3 -C 7 cycloalkyl, wherein the aryl and heteroaryl are optionally substituted by one or more substituents independently selected from OH, C 1 -C 4 alkyl, C 1 -C 4 alkoxy, halogens and C 1 -C 4 haloalkyl; R 3a is selected from H; C 1 -C 8 alkyl optionally substituted by one or more halogen atoms, OH, C 1 -C 4 alkoxy, C 3 -C 7 cycloalkyl or C 3 -C 7 cycloalkyloxy; and C 3 -C 7 cycloalkyl; or R 3 and R 3a taken together are oxo; R 5 and R 6 are independently selected from -(C 0 -C 4 alkyl)-C 6 -C 14 aryl and -(C 0 -C 4 alkyl)-4 to 14 membered heteroaryl, wherein the aryl and heteroaryl are each optionally substituted by one or more Z substituents; W is C 1 -C 8 alkylene optionally substituted by hydroxy, halogens or C 1 -C 4 alkyl; X is C 1 -C 8 alkylene optionally substituted by hydroxy, halogens or C 1 -C 4 alkyl; Y is carboxy, C 1 -C 4 -alkoxycarbonyl, tetrazolyl, -C(=O)NR 19 R 21 or -CONH-S q -R x, wherein R x is phenyl, benzyl or -NR 19 R 21; q is 0, 1 or 2; R 7 is a divalent moiety represented by -O-, -S-, -NHC -, -CH 2 =CH 2 -, -C 6 -C 14 aryl-D-; -3 to 14 membered heterocyclyl-D-, wherein the heterocyclyl contains at least one heteroatom selected from N, O and S, wherein D is O, S, NH or not present; Z is independently OH, aryl, O-aryl, benzyl, O-benzyl, C 1 -C 6 alkyl optionally substituted by one or more OH groups or NH 2 groups, C 1 -C 6 alkyl optionally substituted by one or more halogen atoms, C 1 -C 6 alkoxy optionally substituted by one or more OH groups, C 1 -C 6 alkoxy optionally substituted by one or more halogen, C 1 -C 6 alkoxy optionally substituted by C 1 -C 4 alkoxy, NR 18 (SO 2)R 21, (SO 2)NR 19 R 21, (SO 2)R 21, NR 18 C R 21, C NR 19 R 21, NR 18 C NR 19 R 21, NR 18 C OR 19, NR 19 R 21, C OR 19, C R 19, SR 19, OR 19, oxo, CN, NO 2, halogen or a 3 to 14 membered heterocyclyl, wherein the heterocyclyl contains at least one heteroatom selected from N, O and S; R 18 is independently H or C 1 -C 6 alkyl; R 19 and R 21 are each independently H; C 1 -C 8 alkyl; C 3 -C 8 cycloalkyl; C 1 -C 4 alkoxy-C 1 -C 4 alkyl; -(C 1 -C 4 alkyl)-carboxy; (C 0 -C 4 alkyl)-aryl optionally substituted by one or more groups selected from C 1 -C 6 alkyl, C 1 -C 6 alkoxy and halogen; (C 0 -C 4 alkyl)- 3- to 14-membered heterocyclyl, the heterocyclyl including one or more heteroatoms selected from N, O and S, optionally substituted by one or more groups selected from halogen, oxo, C 1 -C 6 alkyl and C C 1 -C 6 alkyl; (C 0 -C 4 alkyl)-O-aryl optionally substituted by one or more groups selected from C 1 -C 6 alkyl, C 1 -C 6 alkoxy and halogen; and (C 0 -C 4 alkyl)- O-3- to 14-membered heterocyclyl, the heterocyclyl including one or more heteroatoms selected from N, O and S, optionally substituted by one or more groups selected from halogen, C 1 -C 6 alkyl or C C 1 -C 6 alkyl; wherein the alkyl groups are optionally substituted by one or more halogen atoms, OH, C 1 -C 4 alkoxy, C NH 2, C NHC 1 -C 6 alkyl or C N(C 1 -C 6 alkyl) 2; or R 19 and R 21 together with the nitrogen atom to which they attached form a 5- to 10-membered heterocyclyl, the heterocyclyl including one or more further heteroatoms selected from N, O and S, the heterocyclyl being optionally substituted by one or more substituents selected from OH; halogen; aryl; 5- to 10-membered heterocyclyl including one or more heteroatoms selected from N, O and S; S 2 -aryl; S 2 -C 1 -C 6 alkyl; C 1 -C 6 alkyl optionally substituted by one or more halogen atoms; C 1 -C 6 alkoxy optionally substituted by one or more OH groups or C 1 -C 4 alkoxy; and C OC 1 -C 6 alkyl, wherein the aryl and heterocyclyl substituent groups are themselves optionally substituted by C 1 -C 6 alkyl, C 1 -C 6 haloalkyl or C 1 -C 6 alkoxy.