Put all the pastry ingredients in a food processor and blitz until they just start to come together. Turn the pastry out on to a cool work surface, pat into a ball, wrap in greaseproof paper and refrigerate for 45 minutes to an hour.
Meanwhile, in a stand mixer cream the butter and sugars for three or four minutes, until light and fluffy. Beat in the eggs one at a time, mixing each one in well before adding the next, then fold in the vanilla, salt and ground almonds.
Heat the oven to 200C (180C fan)/390F/gas 6. Roll out the chilled pastry on a lightly floured surface into a 26cm square. Butter a 26cm x 26cm square baking tin and lay the pastry on top, gently pushing it into the corners and edges.
Spread the jam evenly over the pastry, followed by the almond mix, smoothing it out with a palette knife. Dot the blackberries over the top, pushing them gently into the batter, then scatter over the flaked almonds. Bake for 35-40 minutes, until golden and set, then remove and leave to cool in the tin.