A method for manufacturing a semiconductor device, comprising: forming a ferroelectric capacitor over a semiconductor substrate; forming a first barrier film directly covering the ferroelectric capacitor; forming a wiring (56a, 56b, 56c; 405a, 405b, 405c; 272) connected to the ferroelectric capacitor; and forming a second barrier film (58; 406; 276) over the wiring, wherein at least one of the forming the first barrier film and the forming the second barrier film comprises the step of forming a film stack including at least two kinds of diffusion preventive films (46a, 46b; 58a, 58b; 406a, 406b; 276a, 276b) having different components and preventing diffusion of one of hydrogen and water, characterised in that: the forming the film stack comprises: forming a first diffusion preventive film (46a; 58a; 406a; 276a) selected from a group consisting of an aluminum oxide film, an aluminum nitride film, and an aluminum oxynitride film; performing thermal treatment in an atmosphere containing oxygen after forming the first diffusion preventive film; and forming a second diffusion preventive film (46b; 58b; 406b; 276b) selected from a group consisting of a titanium oxide film, a tantalum oxide film, a zirconium oxide film, and a tantalum nitride film over the first diffusion preventive film after performing the thermal treatment. forming a ferroelectric capacitor over a semiconductor substrate; forming a first barrier film directly covering the ferroelectric capacitor; forming a wiring (56a, 56b, 56c; 405a, 405b, 405c; 272) connected to the ferroelectric capacitor; and forming a second barrier film (58; 406; 276) over the wiring, wherein at least one of the forming the first barrier film and the forming the second barrier film comprises the step of forming a film stack including at least two kinds of diffusion preventive films (46a, 46b; 58a, 58b; 406a, 406b; 276a, 276b) having different components and preventing diffusion of one of hydrogen and water, characterised in that: the forming the film stack comprises: forming a first diffusion preventive film (46a; 58a; 406a; 276a) selected from a group consisting of an aluminum oxide film, an aluminum nitride film, and an aluminum oxynitride film; performing thermal treatment in an atmosphere containing oxygen after forming the first diffusion preventive film; and forming a second diffusion preventive film (46b; 58b; 406b; 276b) selected from a group consisting of a titanium oxide film, a tantalum oxide film, a zirconium oxide film, and a tantalum nitride film over the first diffusion preventive film after performing the thermal treatment. the forming the film stack comprises: forming a first diffusion preventive film (46a; 58a; 406a; 276a) selected from a group consisting of an aluminum oxide film, an aluminum nitride film, and an aluminum oxynitride film; performing thermal treatment in an atmosphere containing oxygen after forming the first diffusion preventive film; and forming a second diffusion preventive film (46b; 58b; 406b; 276b) selected from a group consisting of a titanium oxide film, a tantalum oxide film, a zirconium oxide film, and a tantalum nitride film over the first diffusion preventive film after performing the thermal treatment. forming a first diffusion preventive film (46a; 58a; 406a; 276a) selected from a group consisting of an aluminum oxide film, an aluminum nitride film, and an aluminum oxynitride film; performing thermal treatment in an atmosphere containing oxygen after forming the first diffusion preventive film; and forming a second diffusion preventive film (46b; 58b; 406b; 276b) selected from a group consisting of a titanium oxide film, a tantalum oxide film, a zirconium oxide film, and a tantalum nitride film over the first diffusion preventive film after performing the thermal treatment.